Creates a room based on an IPFS pub-sub channel. Emits membership events, listens for messages, broadcast and direct messeges to peers.
$ npm install ipfs-pubsub-room
const Room =const ipfs =const room =
ipfs: IPFS object. Must have pubsub activated
roomName: string, global identifier for the room
pollInterval: interval for polling the pubsub peers, in ms. Defaults to 1000.
const room =
Broacasts message (string or buffer).
Sends message (string or buffer) to peer.
Leaves room, stopping everything.
Returns an array of peer identifiers (strings).
Returns a boolean indicating if the given peer is present in the room.
Listens for messages. A
message is an object containing the following properties:
from(string): peer id
data(Buffer): message content
Once a peer has joined the room.
Once a peer has left the room.
Once your program has subscribed the topic and announced through IPFS pubsub.