syncsocket-client

Synchronized messaging application framework client


Keywords
syncsocket, realtime, truetime, synchronization, events
License
MIT
Install
npm install syncsocket-client@0.2.9

Documentation

SyncSocket-client

Synchronized messaging application framework client

Build Status codecov npm npm PRs Welcome

API Docs

Channel

Channel constructor

Parameters

  • connection
  • spec Object Connection options
    • spec.channelId string The channel identifier
    • spec.isPublisher Boolean Flag whether or not user can publish to this channel

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

  • from string State transition was from
  • to string State transitioned to

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

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

Returns Connection Connection object.

connect

Attempts connection to a SyncSocket server.

Parameters

Returns Connection Connection object.

Connection

Creates new Connection object

Parameters

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
    • spec.channelId string The channel identifier
    • spec.isPublisher Boolean Flag whether or not user can publish to this channel

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