basic_bot.commons.messages
Functions from this module are used to send messages to the central_hub via websockets.
MessageTypeIn Objects
Incoming message types (client → central_hub).
MessageTypeOut Objects
Outgoing message types (central_hub → client).
MessageType Objects
Message types for communication to/from central_hub.
WebSocketProtocol Objects
Protocol for websocket objects.
BaseMessage Objects
Base message structure for websocket communication.
IdentityMessage Objects
Identity message for service registration.
StateUpdateMessage Objects
State update message for publishing state changes.
SubscribeMessage Objects
Subscribe message for state key subscriptions.
GetStateMessage Objects
Get state message for requesting current state.
send_message
Send a message to central_hub.
send_identity
Send the identity
type message to central_hub. Name should uniquely
identify the service.
send_subscribe
async def send_subscribe(
websocket: Any, subscriptionNames: Union[List[str],
Literal["*"]]) -> None
Send the subscribeState
message type to central_hub.
subscriptionNames
should be an array of keys to subscribe or "*"
to subscribe to all keys.
send_get_state
Send the getState
message type to central_hub optionally specifying a list
of keys to get the state.
send_update_state
Send the updateState
message type to central_hub with the key->value state data to update.