daemon.api.endpoints.logs module

class daemon.api.endpoints.logs.ConnectionManager[source]

Bases: object

Manager of websockets listening for a log stream.

TODO for now contian a single connection. Ideally there must be one manager per log with a thread checking for updates in log and broadcasting to active connections

Instantiate a ConnectionManager.

async connect(websocket)[source]

Register a new websocket.


websocket (WebSocket) – websocket to register

async disconnect(websocket)[source]

Disconnect a websocket.


websocket (WebSocket) – websocket to disconnect

async broadcast(message)[source]

Send a json message to all registered websockets.


message (dict) – JSON-serializable message to be broadcast