i-peer
v2.3.4
Published
Implementations of the Peer interface
Downloads
26
Readme
Peer
Interface
An object implements the Peer interface if it:
- Inherits from
y-emitterTarget - Has been initialized by the
y-emitterTarget's constructor - Fires a
'msg'event when a message is received - Has the
'ready'state set when it can receive and send messages - Has the
'closed'state set when it will no longer receive and send messages - Has a
.give('msg',msg)method for sending messages, where the acceptable type and structure of msg depends on the object itself, typically JSONable data, and what it is to be sent is a copy of msg at the time this method was called - Has a
.set('closed')method for terminating the connection
Implementations
- WebSocket client
peer = require('i-peer/ws')(url);