2.3.0 • Published 7 years ago
cabal-node v2.3.0
cabal-node
Node.js library for p2p functions for chat.
Usage
npm install cabal-nodeAPI
Table of Contents
Cabal
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.hrefstring The dat linkoptsObject Options include: username
onconnection
When a connection is made. Auto-authorizes new peers to write to the local database. Maintains the local view of visible users.
Parameters
peerObject The discovery-swarm peer emitted from the 'connection' or 'disconnection' event
joinChannel
Join a channel.
Parameters
channelString The channel to join.
leaveChannel
Leave a channel.
Parameters
channelString The channel to leave.
createReadStream
Create a readable stream for the cabal channel.
Parameters
channelString The channel you want to read from.
message
Create a message.
Parameters
channelString The channel to create the message.messageString The message to write.optsObject Options: date, username, type (i.e. message type)donefunction When message has been successfully added.
replicate
Replication stream for the cabal. Shares the username with the other peers it is connecting with.