syncsocket v0.2.13
SyncSocket
Synchronized messaging application framework server
API Docs
Channel
Channel constructor.
Parameters
addClient
Adds client to the channel
Parameters
clientClient
hasClient
Whether a client is joined this channel
Parameters
client
Returns boolean
Channel#error
Channel error
Channel#join
Client joined the channel
Channel#left
Client left the channel
Channel#clientStateChange
Client has switched state
Properties
clientClientnewStatestring
Channel#scheduledMessage
An event has been scheduled
Properties
Server
Server constructor
Parameters
Properties
embeddedTimeserverboolean If set to true, an embedded timeserver will be launchedtimeserverHoststring Clients will connect to this timeserver if no timeserver specified for channeltimeserverPortnumber Clients will connect to this timeserver if no timeserver specified for channel
timeserverUrl
URL of server's default timeserver (set via timeserverHost() and timeserverPort())
Returns string URL
serveClient
Sets/gets whether client code is being served
Parameters
vboolean whether to serve client code
Returns (Server | boolean) self when setting or value when getting
embeddedTimeserver
Sets/gets whether embedded timeserver is active
Parameters
vboolean whether to activate integrated timeserver
Returns (Server | boolean) self when setting or value when getting
timeserverHost
Sets/gets timeserver host to which clients will connect if no timeserver specified for channel
Parameters
vstring default host
Returns (Server | string) self when setting or value when getting
timeserverPort
Sets/gets timeserver port to which clients will connect if no timeserver specified for channel
Parameters
vnumber default port
Returns (Server | number) self when setting or value when getting
listen
Attaches to a server or port
Parameters
Returns Server self
createChannel
Creates a channel
Parameters
channelId?string channel id or null. If null, then id will be generated
Returns ?Channel that has been created or null
addToChannel
Adds a client to a specific channel
Parameters
Returns boolean Operation result
getChannel
Get specific channel
Parameters
channelIdChannel id
Returns ?Channel
close
Shuts down the server
Returns Server
Server#connection
Client has successfully connected
Server#disconnect
Client has disconnected