Skip to main content

Module websocket

Module websocket 

Source
Expand description

WebSocket dispatcher for bidirectional A2A communication.

Provides WebSocketDispatcher that upgrades HTTP connections to WebSocket and handles JSON-RPC messages over the WebSocket channel. Streaming responses are sent as individual WebSocket text frames rather than SSE.

§Protocol

  • Client sends JSON-RPC 2.0 requests as text frames
  • Server responds with JSON-RPC 2.0 responses as text frames
  • For streaming methods (SendStreamingMessage, SubscribeToTask), the server sends multiple frames: one per SSE event, followed by a final JSON-RPC success response
  • Connection closes cleanly on WebSocket close frame

§Feature gate

Requires the websocket feature flag:

a2a-protocol-server = { version = "0.2", features = ["websocket"] }

Structs§

WebSocketDispatcher
WebSocket-based A2A dispatcher.