hubsclient.client#
Module Contents#
Classes#
API#
- class hubsclient.client.MSG#
- channel: int | None = None#
- id: int | None = None#
- target: str = <Multiline-String>#
- cmd: str = <Multiline-String>#
- data: object = None#
- classmethod from_json(json_str: str) hubsclient.client.MSG#
Parse JSON message.
- Parameters:
json_str – JSON string
- Returns:
MSG
- to_json() str#
Convert to JSON string.
- Returns:
JSON string
- __str__ = None#
- class hubsclient.client.HubsClient(host: str, room_id: str, avatar_id: str = None, display_name: str = 'API Client')#
Initialization
Hubs room client.
- Parameters:
host – The host of the room, e.g. “hubs.mozilla.com”
room_id – The hub room ID code
avatar_id – The avatar ID
display_name – The display name for the avatar
- send_cmd(ch, tgt, cmd, body)#
Send a command to a channel.
- Parameters:
ch – Channel number
tgt – Channel target
cmd – Command
body – Payload body
- send8(cmd: str, body: dict)#
Send a command on channel 8, resource update.
- Parameters:
cmd – Command
body – Payload body
- send_naf(naf: hubsclient.naf.NAF)#
Send a NAF update.
- Parameters:
naf – NAF object
- send_chat(message: str)#
Send a chat message.
- Parameters:
message – Message to send
- get_message(wait: bool = False) hubsclient.client.MSG#
Get a message from the socket.
- Parameters:
wait – Whether to block until a message is received
- Returns:
MSG
- sync()#
- send_heartbeat()#
Send a heartbeat.
- _join()#
- close()#
Close the connection.