SyncSocket-client
Synchronized messaging application framework client
API Docs
Channel
Channel constructor
Parameters
-
connection
-
spec
Object Connection options
subscribe
Subscribes for messages on given topic
.
Subscribing to topic #
will make you subscribe to any message in the channel.
Parameters
-
topic
string -
prepareCallback
function (Any): Any The callback called during prepare transition -
fireCallback
function (Any): Any The callback called during the 'fire' event
publish
Publishes a user message to the channel
Parameters
Channel#transition
Channel switched state
Properties
Channel#error
Error in channel
Channel#syncSuccessful
Synchronization with timeserver succeeded
Properties
-
error
number Reading's max variation from truth (ms) -
adjust
number Difference between local and remote clocks (ms)
Channel#syncFailed
Synchronization with timeserver failed
Properties
-
error
number Reading's max variation from truth (ms) -
adjust
number Difference between local and remote clocks (ms)
Connection
Creates new Connection
object
Parameters
-
uri
URI of SyncSocket server (e.g. http://localhost:5579)
close
Disconnects from the server
joinChannel
Attempt joining a channel with id channelId
.
Parameters
-
channelId
-
canPublish
Returns Promise Fulfilled promise returns the Channel
object, rejected — error message.
Connection#connected
Client successfully connected to server
Connection#error
Connection error
Connection#disconnected
Client disconnected from server
Connection#connection-error
Error while connecting to server
connect
Attempts connection to a SyncSocket server.
Parameters
-
uri
string Server URI
Returns Connection Connection
object.
connect
Attempts connection to a SyncSocket server.
Parameters
-
uri
string Server URI
Returns Connection Connection
object.
Connection
Creates new Connection
object
Parameters
-
uri
URI of SyncSocket server (e.g. http://localhost:5579)
close
Disconnects from the server
joinChannel
Attempt joining a channel with id channelId
.
Parameters
-
channelId
-
canPublish
Returns Promise Fulfilled promise returns the Channel
object, rejected — error message.
Channel
Channel constructor
Parameters
-
connection
-
spec
Object Connection options
subscribe
Subscribes for messages on given topic
.
Subscribing to topic #
will make you subscribe to any message in the channel.
Parameters
-
topic
string -
prepareCallback
function (Any): Any -- The callback called during prepare transition -
fireCallback
function (Any): Any -- The callback called during the 'fire' event
publish
Publishes a user message to the channel
Parameters