Controller

flitter-socket/Controller~ Controller

Special class of controller that includes bootstrap methods for using flitter-socket.


Constructor

new Controller()

Initialize the controller.

Extends

Members

connections :Object

Map of connection IDs to open connection managers.

Type:
  • Object

Methods

_blast(endpoint, data, handler)

Send a request to all connected clients.

Parameters:
Name Type Description
endpoint string

the endpoint to request data from

data object

the request's body data

handler function

callback function called each time a client response is received

_client_connected(connection_manager)

Called when a new connection manager has been started.

Parameters:
Name Type Description
connection_manager module:flitter-socket/ConnectionManager~ConnectionManager

_connect(ws, req)

Route helper for bootstrapping a transactional websocket connection. Wraps the socket in a new {flitter-socket/ConnectionManager~ConnectionManager} and adds it to this.connections.

Parameters:
Name Type Description
ws WebSocket

the incoming websocket

req express/Request

the connection request

_request(endpoint, data, handler, client_id)

Send a request to one websocket client.

Parameters:
Name Type Description
endpoint string

the endpoint to request data from

data object

the request's body data

handler function

callback function called when a valid client response has been received.

client_id string

connection id to whom the request should be sent.

_request_async(endpoint, data, client_id)

Async wrapper for this._request().

Parameters:
Name Type Description
endpoint string

the endpoint to request data from

data object

the request's body data

client_id string

connection id to whom the request should be sent.