pytweezer.servers.messageclient module

class pytweezer.servers.messageclient.MessageClient(name)[source]

Bases: GenericClient

Standardized way of sending messages over the message stream

has_new_data()[source]

check whether a new message has arrived (without reading it)

recv(flags=0, copy=True, track=False)[source]

recv a dictionary (and a numpy array)

Parameters:
  • flags – ZMQ recieving options (leave as defaults unless you RTFM of ZMQ)

  • copy – ZMQ recieving options (leave as defaults unless you RTFM of ZMQ)

  • track – ZMQ recieving options (leave as defaults unless you RTFM of ZMQ)

send(channel='info', message='', flags=0)[source]

distribute over ZMQ

Parameters:
  • datadict (dict) – data to be send (must be json serializable)

  • A (np.array) – optional array of data

  • channel (string) – subchannel (will be appended to name when sending)

  • flags (int) – see ZMQ send flags in the ZMQ doku

send_json(channel, payload, flags=0)[source]

Publish a topic plus structured JSON payload.

pytweezer.servers.messageclient.get_message_client(name=None)[source]

Return the shared MessageClient, creating it on first use.

pytweezer.servers.messageclient.send_debug(msg)[source]
pytweezer.servers.messageclient.send_error(msg)[source]

send error message

Parameters:

msg (str) – message

pytweezer.servers.messageclient.send_info(msg)[source]
pytweezer.servers.messageclient.send_msg(msg, errlevel)[source]
pytweezer.servers.messageclient.send_warning(msg)[source]

send warning message

Parameters:

msg (str) – message