Server - lzbk/BrowserQuest GitHub Wiki
Source file: server/js/ws.js
Abstract class for server objects
Properties
port
--[number]
Port the server runs onconnection_callback
--[function]
Callback to be run when client connects?error_callback
--[function]
Callback to be run on error events_connections
--[array]
Array ofConnection
objects
Methods
init(port)
onConnect(callback)
onError(callback)
broadcast(message)
forEachConnection(callback)
addConnection(connection)
removeConnection(id)
getConnection(id)
init(port)
Assigns port
to this.port
.
onConnect(callback)
Assigns callback
to this.connection_callback
.
onError(callback)
Assigns callback
to this.error_callback
.
broadcast(message)
Throws "not implemented".
forEachConnection(callback)
Loops through this._connections
and runs callback
, passing the connection object as an argument.
removeConnection(id)
Deletes this._connections[id]
.
getConnection(id)
Returns this._connections[id]
.