xia_broadcast_listener.listener.BroadcastListener
- class xia_broadcast_listener.listener.BroadcastListener(uri: str, header: dict, channel_config: dict)
Bases:
object
Listener to Broadcast
- __init__(uri: str, header: dict, channel_config: dict)
Methods
__init__
(uri, header, channel_config)connect
(on_open, on_error, on_close[, id_only])Connect to websocket server
listen
(on_open, on_message, on_error, on_close)Get message from broadcast
- async connect(on_open, on_error, on_close, id_only: bool = False)
Connect to websocket server
- Parameters
on_open – Callback when connection is open
on_close – Callback when connection is closes
on_error – Callback when error occurs
id_only – Only get document id in the message body
- async listen(on_open, on_message, on_error, on_close, id_only: bool = False)
Get message from broadcast
- Parameters
on_open – Callback when connection is open
on_message – The callback function (sync), accept message as output
on_close – Callback when connection is closes
on_error – Callback when error occurs
id_only – Only get document id in the message body
- Returns
None