0.0.40 • Published 1 year ago
@dao-xyz/ipfs-pubsub-direct-channel v0.0.40
ipfs-pubsub-direct-channel
Communication channel between two peers over IPFS Pubsub
Work in progress!
ipfs-pubsub-direct-channel
is a 1-to-1 communication channel over IPFS Pubsub. It enables two peers to exchange messages between each other. Note that the channel is currently not authenticated nor encrypted!
Usage
// Include as lib
const Channel = require('ipfs-pubsub-direct-channel')
// Create IPFS instance somehow
const ipfs = new IPFS()
// IPFS peer ID of the peer to connect to
const friendId = 'QmP9TWCAsHLs6a3hcCbqE6WZs3VhQF6QsmkFPAFmmcuMa6'
// Open a channel with the other peer
const channel = await Channel.open(ipfs, friendId)
// Explicitly wait for peers to connect
await channel.connect()
// Send message on the channel
await channel.send('Hello World!')
// Process messages from the other peer
channel.on('message', (message) => {
console.log('Message from', message.from, message)
})
For more usage examples, see the tests
0.0.40
1 year ago
0.0.23
2 years ago
0.0.24
2 years ago
0.0.25
1 year ago
0.0.37
1 year ago
0.0.38
1 year ago
0.0.39
1 year ago
0.0.30
1 year ago
0.0.31
1 year ago
0.0.32
1 year ago
0.0.33
1 year ago
0.0.34
1 year ago
0.0.35
1 year ago
0.0.36
1 year ago
0.0.26
1 year ago
0.0.27
1 year ago
0.0.28
1 year ago
0.0.29
1 year ago
0.0.22
2 years ago
0.0.21
2 years ago
0.0.20
2 years ago
0.0.19
2 years ago
0.0.18
2 years ago
0.0.17
2 years ago
0.0.16
2 years ago
0.0.15
2 years ago
0.0.14
2 years ago
0.0.13
2 years ago
0.0.12
2 years ago
0.0.11
2 years ago
0.0.10
2 years ago