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: int | None = None, reason: str | None = None) None[source]

Close the websocket.

read_message(callback: Callable[..., Any] | None = None) Awaitable[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.