ait.core.server.utils module

ait.core.server.utils.decode_message(msg)

Decode a message received via 0MQ

Given a message received from recv_multipart, decode the components.

Returns a tuple of the form:
(
UTF-8 string De-pickled data object

)

If decoding fails a tuple of None objects will be returned.

ait.core.server.utils.encode_message(topic, data)

Encode a message for sending via 0MQ

Given a string topic name and a pickle-able data object, encode and prep the data for sending via send_multipart

Returns a list of the form:
[
Bytes object of String (UTF-8), Pickled data object

]

If encoding fails None will be returned.