Abstracts socket.io messaging into a simpler interface.
This is the base class inherited by client-endpoint and server-endpoint.
npm i -S @cameronwp/endpoint- onmessage(type, [historical]) ⇒
subscription Subscribe an action to perform when a message is received.
- onchange() ⇒
subscription Subscribe an action to perform when the connection changes.
- clear()
Remove all subscriptions to connection events.
- connectionCallback :
function Connection callback.
- changeCallback :
function Changed connction callback.
- messageResponse :
function Message response callback.
Base class for handling socket.io connections.
Subscribe an action to perform when a message is received.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| type | string |
||
messageResponse |
|||
| [historical] | boolean |
false |
Whether or not to call the listener if this message has been received before this listener was set. |
Subscribe an action to perform when the connection changes.
Kind: global function
| Type |
|---|
changeCallback |
Remove all subscriptions to connection events.
Connection callback.
Kind: global typedef
| Param | Type | Description |
|---|---|---|
| sID | string |
Socket ID. |
Changed connction callback.
Kind: global typedef
| Param | Type | Description |
|---|---|---|
| count | number |
Number of connections |
Message response callback.
Kind: global typedef
| Param | Type |
|---|---|
| response | any |