bokeh.client.websocket

Provide a low-level wrapper for Tornado Websockets that adds locking and smooths some compatibility issues.

class WebSocketClientConnectionWrapper(socket: tornado.websocket.WebSocketClientConnection)[source]

Used for compatibility across Tornado versions and to add write_lock

close(code: Optional[int] = None, reason: Optional[str] = None) None[source]

Close the websocket.

read_message(callback: Optional[Callable[[...], Any]] = None) Awaitable[Union[None, str, bytes]][source]

Read a message from websocket and execute a callback.

async write_message(message: str | bytes, binary: bool = False, locked: bool = True) None[source]

Write a message to the websocket after obtaining the appropriate Bokeh Document lock.