Skip to content

Commit b3f0849

Browse files
authored
Update client.py
1 parent 05c0113 commit b3f0849

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

hivemind_bus_client/client.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -346,20 +346,20 @@ def _handle_hive_protocol(self, message: HiveMessage):
346346
def emit(self, message: Union[MycroftMessage, HiveMessage],
347347
binary_type: HiveMindBinaryPayloadType = HiveMindBinaryPayloadType.UNDEFINED):
348348
"""
349-
Send a HiveMind message (or wrap and send a MycroftMessage) and optionally transmit it as a binary payload.
350-
351-
Parameters:
352-
message (MycroftMessage | HiveMessage): The outgoing message. A MycroftMessage will be wrapped into a BUS HiveMessage.
353-
binary_type (HiveMindBinaryPayloadType): Binary payload subtype to use when sending BINARY messages; defaults to UNDEFINED.
354-
355-
Behavior:
356-
- For BUS messages, ensures payload.context contains routing fields (source, platform, destination, session_id, site_id) and emits the payload to the client's internal bus before sending.
357-
- Chooses binary or text transport according to message type and client configuration; the payload may be compressed and/or encrypted based on client settings.
358-
359-
Raises:
360-
ValueError: If the client has not been started (run_forever() not executed) and therefore cannot send messages.
361-
RuntimeError: If the client was started but the websocket connection did not open within the wait period, preventing the message from being sent.
362-
"""
349+
Send a HiveMind message (or wrap and send a MycroftMessage) and optionally transmit it as a binary payload.
350+
351+
Parameters:
352+
message (MycroftMessage | HiveMessage): The outgoing message. A MycroftMessage will be wrapped into a BUS HiveMessage.
353+
binary_type (HiveMindBinaryPayloadType): Binary payload subtype to use when sending BINARY messages; defaults to UNDEFINED.
354+
355+
Behavior:
356+
- For BUS messages, ensures payload.context contains routing fields (source, platform, destination, session_id, site_id) and emits the payload to the client's internal bus before sending.
357+
- Chooses binary or text transport according to message type and client configuration; the payload may be compressed and/or encrypted based on client settings.
358+
359+
Raises:
360+
ValueError: If the client has not been started (run_forever() not executed) and therefore cannot send messages.
361+
RuntimeError: If the client was started but the websocket connection did not open within the wait period, preventing the message from being sent.
362+
"""
363363
if isinstance(message, MycroftMessage):
364364
message = HiveMessage(msg_type=HiveMessageType.BUS,
365365
payload=message)
@@ -544,4 +544,4 @@ def emit_intercom(self, message: Union[MycroftMessage, HiveMessage],
544544
signature = sign_RSA(private_key, encrypted_message)
545545

546546
self.emit(HiveMessage(HiveMessageType.INTERCOM, payload={"ciphertext": pybase64.b64encode(encrypted_message),
547-
"signature": pybase64.b64encode(signature)}))
547+
"signature": pybase64.b64encode(signature)}))

0 commit comments

Comments
 (0)