-
Notifications
You must be signed in to change notification settings - Fork 8
API reference
Public APIs:
- init
- send
- onReceived
- onDisconnectedFromServer
- onClientConnected
- onClientDisconnected
- onLatencyUpdated
- destroy
Parameter is an object containing these properties:
Path of the protocol definition JSON file. Mandatory for both server and client.
Path of the RhubarbWorker JS file. Mandatory for client.
A boolean specifies wheter the Rhubarb will be used a server or a client. Default is false.
The WebSocket URL of the server. Mandatory for client.
The port which the server listens. Mandatory for server.
A callback function executed when the Rhubarb is initialized. Mandatory for client.
A callback function executed with error parameter when an error occurs while initializing Rhubarb. Mandatory for client.
Expects three parameters:
The protocol name as defined in protocol-definition JSON file. This parameter is mandatory
An object containing values by parameter names as defined in protocol-definition JSON file. This parameter is mandatory
The ID of client which the server sends the message to. Mandatory for the server.
Expects two parameters:
The protocol name as defined in protocol-definition JSON file. This parameter is mandatory
A callback function executed with getter and clientID parameters when the message is received:
- getter: A function expects a protocol parameter name as input and returns received value for that parameter.
- clientID: (For servers only): The unique client ID representing the client sent the message to server.
This parameter is mandatory.
Expects one parameter:
A function that is executed when the client disconnects from a server.
Expects one parameter:
A function that is executed with clientID parameter when a client connects to the server. The clientID is the unique identifier of the connected client.
Expects one parameter:
A function that is executed with clientID parameter when a client disconnects from the server. The clientID is the unique identifier of the connected client.
Expects one parameter:
A function that is executed with the new latency (a float) when the latency between the server and the client is updated.
Expects no parameter. Destroys the Rhubarb context and removes all connections.