Python API Reference#


DimeClient#

DimeClient(protocol, varargin)

Creates a new DiME instance using the specified protocol. If no arguments are given, the function will default to using ipc and tmp/dime.sock.

Parameters

Name

Type

Description

protocol

string

The chosen protocol. Must either be ipc or tcp.

ipc: The function expects one additional argument - the pathname of the Unix socket to connect to.

tcp: The function expects two additional arguments - the hostname (string) and port (int) of the socket, in that order.

varargin

string or string, int

Additional parameters. Varies based on the protocol chosen.


Returns

Type

Description

DimeClient

The newly created DimeClient

close#

DimeClient.close()

Closes the connection for the DimeClient instance.

join#

DimeClient.join(varargin)

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

Parameters

Name

Type

Description

varargin

string, string, ...

A tuple of 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, ...

A tuple of strings containing the group names for the client to leave.

Send#

DimeClient.send(name, varargin)

Send a "send" command to the server. Sends one or more variables from the mapping of this instance to all clients in a specified group.

Parameters

Name

Type

Description

name

string

The name of the group to send the variables to.

varargin

string, string, ...

A tuple of the names of the variables being sent.

send_r#

DimeClient.send_r(name, **kvpairs)

Sends one or more key value pairs to all clients in a specified group.

Parameters

Name

Type

Description

name

string

The name of the group to send the variables to.

kvpairs

dict

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

varargins

string, string, ...

A tuple of 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

dict

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

int

The number of variables to retrieve from the server.

sync_r#

DimeClient.sync_r

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

int

The number of variables to retrieve from the server.


Returns

Type

Description

dict

A dictionary of variable names and values sent to the client.

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#

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

Returns

Type

Description

[string, string, ...]

A list containing names of all the groups connected to the DiME server.