Skip to content

1-to-1 communication channel over IPFS Pubsub between two peers

Notifications You must be signed in to change notification settings

ChluNetwork/ipfs-pubsub-1on1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ipfs-pubsub-1on1

Communication channel between two peers over IPFS Pubsub

Work in progress!

ipfs-pubsub-1on1 is a 1-to-1 communication channel over IPFS Pubsub. It enables two peers to exchange messages between each other.

Usage

// Include as lib
const Channel = require('ipfs-pubsub-1on1')
// Create IPFS instance somewhow
const 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()
// Process messages from the other peer
channel.on('message', (message) => {
  console.log("Message from", message.from, message)
})

For more usage examples, see the tests

About

1-to-1 communication channel over IPFS Pubsub between two peers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%