core.messaging.message_payload
MessagePayload Objects
class MessagePayload()
Class holding arbitrary payload data (as key-value pairs) of a message.
set
def set(key: str, data: PayloadData) -> None
Sets a payload item.
Arguments:
key- The key of the item.data- The item data.
get
def get(key: str) -> PayloadData | None
Retrieves a payload item.
Arguments:
key- The key of the item.
Returns:
The item data or None otherwise.
contains
def contains(key: str) -> bool
Checks if an item exists.
Arguments:
key- The key of the item.
clear
def clear(key: str | None = None) -> None
Removes an item or clears the entire payload.
Arguments:
key- The key of the item; if set to None, all items will be removed.
encode
def encode() -> Payload
Encodes the payload for message passing.
Returns:
The encoded data.
decode
def decode(payload: Payload) -> None
Decodes the payload from message passing.
Arguments:
payload- The incoming payload.