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
- The full A2A method surface is routed — the same v1.0
PascalCasemethod names as the JSON-RPC HTTP dispatcher (v0.3-style names such asmessage/sendare rejected withMethodNotFound, matching the reference SDK) - The upgrade request’s HTTP headers are captured at the handshake and passed to the handler for every request on the connection, so authentication and tenant resolution behave as they do over HTTP
§Feature gate
Requires the websocket feature flag:
a2a-protocol-server = { version = "0.7", features = ["websocket"] }Structs§
- WebSocket
Dispatcher - WebSocket-based A2A dispatcher.