WebSocket

The WebSocket module in DOLOST provides functionality for handling WebSocket connections and communication with clients.

WebSocket endpoints enable real-time bidirectional communication between the DOLOST server and connected clients. These endpoints are used to transmit updates, statistics, and other real-time data to clients without the need for continuous polling.

class DOLOST.blueprints.websocket.WebSocketNamespace(namespace=None)[source]

Bases: Namespace

Namespace for WebSocket connections.

on_connect(*args)[source]

Callback function triggered when a client connects.

Parameters:

*args – Variable length argument list.

on_disconnect(*args)[source]

Callback function triggered when a client disconnects.

Parameters:

*args – Variable length argument list.

on_request_activity()[source]

Callback function triggered on request for activity logs.

Starts a new thread to continuously send activity logs to clients.

on_request_data(json_data)[source]

Callback function triggered on request for data.

Parameters:

json_data (dict) – JSON object containing the request data. Should contain ‘container_id’ key.

send_activity_logs()[source]

Send activity logs to clients.

Continuously fetches and emits activity logs until stop event is set.