Node.js library for p2p functions for chat.
npm install cabal-node
Create a new Cabal. This is the object handling all local nickname -> cabal interactions for a single user.
Parameters
storage
(string | function) A hyperdb compatible storage function, or a string representing the local data path.href
string The dat linkopts
Object Options include: username
When a connection is made. Auto-authorizes new peers to write to the local database. Maintains the local view of visible users.
Parameters
peer
Object The discovery-swarm peer emitted from the 'connection' or 'disconnection' event
Join a channel.
Parameters
channel
String The channel to join.
Leave a channel.
Parameters
channel
String The channel to leave.
Create a readable stream for the cabal channel.
Parameters
channel
String The channel you want to read from.
Create a message.
Parameters
channel
String The channel to create the message.message
String The message to write.opts
Object Options: date, username, type (i.e. message type)done
function When message has been successfully added.
Replication stream for the cabal. Shares the username with the other peers it is connecting with.