Skip to content

vllm_omni.entrypoints.duplex.websocket

WebSocket transport helpers for the duplex Realtime handler.

The ordered session mailbox and the per-session task handles that used to be defined here now live engine-side (vllm_omni.engine.duplex.session.runner).

CloseFn module-attribute

CloseFn = Callable[[str], Awaitable[None]]

MAX_EVENT_BYTES module-attribute

MAX_EVENT_BYTES = 15 * 1024 * 1024

SendJson module-attribute

SendJson = Callable[[dict[str, object]], Awaitable[None]]

attachment_callbacks

attachment_callbacks(
    websocket: WebSocket,
) -> tuple[SendJson, CloseFn]

send / close callables for a DuplexSessionAttachmentRegistry attachment.

A send on a socket that already closed surfaces as WebSocketDisconnect so the caller's disconnect path runs instead of a generic failure.

receive_text_with_timeout async

receive_text_with_timeout(
    websocket: WebSocket, timeout_s: float | None
) -> str | None

Receive one text frame; None on idle timeout. Disconnects propagate.