Skip to content

common

messageflux.iodevices.base.common

Message

Message(data, headers=None)

this class is the basic unit that is read from, or sent to devices.

Parameters:

Name Type Description Default
data Union[BinaryIO, bytes]

the bytes/stream containing the body of the message

required
headers Optional[MessageHeaders]

(optional) headers containing metadata about the message

None

bytes property

bytes

Returns:

Type Description

the data of the message (reads the stream from current position to the end, than resets the position to the original value)

headers property

headers

the headers for this message

stream property

stream

the stream for this message. notice that reading the stream, advances its position

copy

copy(new_headers=None)

makes a copy of the message, possibly giving it a new headers

MessageBundle

MessageBundle(message, device_headers=None)

this class holds a message and device headers (to get from device, or send to device)

Parameters:

Name Type Description Default
message Message

The Message.

required
device_headers Optional[DeviceHeaders]

Additional Headers that may return data from device, or affect its operation.

None

device_headers property

device_headers

Additional Headers that may return data from device, or affect its operation.

message property

message

the message in this bundle