WebSocket Client
flow_it_api.websocket
WebSocket client for the FlowIt VMC API.
Classes
FlowItWebSocket
Handles real-time updates from the VMC machine via WebSocket.
Source code in src/flow_it_api/websocket.py
Methods:
__init__(host, auth, on_data=None)
Initialize the WebSocket client.
:param host: Base URL of the VMC machine. :param auth: Authenticator instance for token management. :param on_data: Optional async callback for received data.
Source code in src/flow_it_api/websocket.py
listen()
async
Start the websocket listener loop.
Handles reconnection and authentication automatically.
Source code in src/flow_it_api/websocket.py
register_callback(callback)
Register a callback to be called when new data is received via websocket.
:param callback: Async function to call with the new MachineData. :return: A function that can be called to unregister the callback.
Source code in src/flow_it_api/websocket.py
start()
stop()
async
Stop the websocket listener and cancel the task.