0.1.1 • Published 8 years ago
@cameronwp/endpoint v0.1.1
Endpoint
Abstracts socket.io messaging into a simpler interface.
This is the base class inherited by client-endpoint and server-endpoint.
npm i -S @cameronwp/endpointAPI
Classes
Functions
Typedefs
Endpoint
Kind: global class
new Endpoint()
Base class for handling socket.io connections.
onmessage(type, historical) ⇒ subscription
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. |
onchange() ⇒ subscription
Subscribe an action to perform when the connection changes.
Kind: global function
| Type |
|---|
| changeCallback |
clear()
Remove all subscriptions to connection events.
Kind: global function
connectionCallback : function
Connection callback.
Kind: global typedef
| Param | Type | Description |
|---|---|---|
| sID | string | Socket ID. |
changeCallback : function
Changed connction callback.
Kind: global typedef
| Param | Type | Description |
|---|---|---|
| count | number | Number of connections |
messageResponse : function
Message response callback.
Kind: global typedef
| Param | Type |
|---|---|
| response | any |