socket.io-bridge-client
v1.0.0
Published
Real-time bidirectional event-based communication between two socket.io clients
Downloads
4
Maintainers
Readme
socket.io-bridge-client
Client implementation for socket.io-bridge.
Please find the project documentation at https://github.com/michaelfranzl/socket.io-bridge .
API Reference
Classes
Typedefs
BridgeClient
Kind: global class
- BridgeClient
- new BridgeClient(opts)
- static
- .make(opts) ⇒ Promise
- inner
- ~onconnection : function
new BridgeClient(opts)
| Param | Type | | --- | --- | | opts | Object | | opts.socket | Socket |
BridgeClient.make(opts) ⇒ Promise
Make a Socket.IO bridge to another client.
Kind: static method of BridgeClient
Returns: Promise - - Promise resolving with a Socket.IO client socket connecting to the
requested peer/client. The Promise can be used only for a single connection, e.g. when peerUid
is set and there will be no incoming connections.
| Param | Type | Default | Description | | --- | --- | --- | --- | | opts | Object | | | | [opts.uid] | string | "globally unique" | Our ID. | | [opts.peerUid] | string | | The ID of the peer we want to establish a connection to. | | [opts.onconnection] | onconnection | | Called for each incoming connection. | | [opts.logger] | object | | No logging by default |
BridgeClient~onconnection : function
Called as soon as the peer identified by peerUid is available for a connection.
Kind: inner typedef of BridgeClient
| Param | Type | Description | | --- | --- | --- | | socket | Socket | Socket.IO client socket connecting to the requested peer/client. |
Socket
Kind: global typedef
See: https://github.com/socketio/socket.io-client/blob/master/docs/API.md#socket