JavaScript API Reference#


DimeClient#

new dime.DimeClient(hostname, port)

Creates a new DiME instance and connects to the server.

Parameters

Name

Type

Description

hostname

string

The hostname of the server

port

number

The port the server is running on.


Returns

Type

Description

DimeClient

The newly created DimeClient.

close#

DimeClient.close()

Performs cleanup on the DimeClient connection.

join#

DimeClient.join(varargin)

Instructs the DiME server to add the client to the specified groups.

Parameters

Name

Type

Description

varargin

string, string, ...

Strings containing the group names for the client to join.

leave#

DimeClient.leave(varargin)

Instructs the DiME server to remove the client from the specified groups.

Parameters

Name

Type

Description

varargin

string, string, ...

Strings containing the group names for the client to leave.

send#

DimeClient.send(name, varargin)

Sends one or more variables to the specified group.

Parameters

Name

Type

Description

name

string

The name of the group to send the variables to.

varargin

string, string, ...

The names of the variables being sent.

send_r#

DimeClient.send_r(name, kvpairs)

Sends one or more variables to all clients in a specified group.

Parameters

Name

Type

Description

name

string

The name of the group to send the variables to.

varargin

associative array

Key value pairs to be sent to the server.

broadcast#

DimeClient.broadcast(varargin)

Sends one or more variables to all other clients.

Parameters

Name

Type

Description

varargin

string, string, ...

The names of the variables being sent.

broadcast_r#

DimeClient.broadcast_r(kvpairs)

Sends one or more key value pairs to all other clients.

Parameters

Name

Type

Description

kvpairs

associative array

Key value pairs to be sent to the server.

sync#

DimeClient.sync(n)

Requests all variables that have been sent to this client by other clients.

Sync will retrieve all variables if n is left unspecified or set to a negative value.

Parameters

Name

Type

Description

n

number

The number of variables to retrieve from the server.

sync_r#

DimeClient.sync_r(n)

Requests all variables that have been sent to this client by other clients.

Sync will retrieve all variables if n is left unspecified or set to a negative value.

Parameters

Name

Type

Description

n

number

The number of variables to retrieve from the server.

wait#

DimeClient.wait()

Requests that the server sends a message to the client once a message has been received for said client. This call will block the current thread until the message is received.

devices#

DimeClient.devices()

Requests a list of all named, nonempty groups from the server.

Returns

Type

Description

string[]

An array containing names of all the groups connected to the DiME server.