i-peer

2.3.4 • Public • Published

Peer

Interface

An object implements the Peer interface if it:

  • Inherits from y-emitter Target
  • Has been initialized by the y-emitter Target'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);

Readme

Keywords

none

Package Sidebar

Install

npm i i-peer

Weekly Downloads

4

Version

2.3.4

License

Apache-2.0

Last publish

Collaborators

  • manvalls