Class: Client

Client

A Stormancer client for connecting to Stormancer server applications.

Constructor

new Client(config)

Creates a client. You need to construct a configuration before using this method.

Parameters:
Name Type Description
config Stormancer.Configuration

The configuration object for constructing the Client.

Source:

Members

applicationName :string

The name of the Stormancer server application the client is connected to.

Type:
  • string
Source:

id :string

The client's unique stormancer ID. Returns null if the ID has not been acquired yet (connection still in progress).

Type:
  • string
Source:

logger :object

An user specified logger.

Type:
  • object
Source:

serverPing :number

The server connection's ping in milliseconds.

Type:
  • number
Source:

Methods

clock() → {number}

Get the server clock. Represented by the count of milliseconds since the cluster started.

Source:
Returns:

The number of milliseconds since the application started.

Type
number

disconnect()

Disconnects the client.

Source:

getPublicScene(sceneId, userData) → {Promise}

Retrieve a public scene object from its ID.

Parameters:
Name Type Description
sceneId string

The scene ID

userData object

User data to send

Source:
Returns:

Promise which complete when the scene is ready to connect.

Type
Promise

getScene(token) → {Promise}

Retrieve a scene object from its ID.

Parameters:
Name Type Description
token string

Scene token

Source:
Returns:

Promise which complete when the scene is ready to connect.

Type
Promise