0.1.1 • Published 7 years ago

@cameronwp/endpoint v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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/endpoint

API

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

ParamTypeDefaultDescription
typestring
messageResponse
historicalbooleanfalseWhether 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

ParamTypeDescription
sIDstringSocket ID.

changeCallback : function

Changed connction callback.

Kind: global typedef

ParamTypeDescription
countnumberNumber of connections

messageResponse : function

Message response callback.

Kind: global typedef

ParamType
responseany