Skip to content

feat(websocket): add websocket cpb for a2a-rs#63

Open
hackeramitkumar wants to merge 10 commits into
a2aproject:mainfrom
hackeramitkumar:feat/websocket
Open

feat(websocket): add websocket cpb for a2a-rs#63
hackeramitkumar wants to merge 10 commits into
a2aproject:mainfrom
hackeramitkumar:feat/websocket

Conversation

@hackeramitkumar
Copy link
Copy Markdown

@hackeramitkumar hackeramitkumar commented May 5, 2026

Summary

This PR adds the initial WebSocket transport binding for a2a-rs, improves coverage around the new client/server behavior, and aligns push-notification handling with the current v1.0.0 A2A schema.

What Changed

  • Added a2a-websocket support for the WEBSOCKET transport protocol.
  • Implemented a WebSocket client transport that multiplexes:
    • unary requests
    • streaming requests
    • stream cancellation
    • connection teardown
  • Implemented a WebSocket server router for Axum using the a2a.v1 subprotocol.
  • Added WebSocket envelope handling for:
    • request/response messages
    • streaming events
    • streamEnd
    • structured WebSocket error envelopes
    • fatal protocol closes
  • Added end-to-end tests that boot a real Axum server and connect with WebSocketTransport.
  • Added focused unit tests for client, server, common protocol helpers, and error mapping.
  • Switched the WebSocket client pending-state mutex to parking_lot::Mutex.
  • Updated push-notification config usage to the current flat TaskPushNotificationConfig model.
  • Added TRANSPORT_PROTOCOL_WEBSOCKET.

Notes

  • wss:// endpoints are currently rejected with a clear unsupported error; TLS can be handled upstream for now.
  • Binary WebSocket frames are rejected/reserved for future use.
  • The client enforces a2a.v1 subprotocol negotiation.
  • Stream drops send a cancelStream envelope to the server.

Verification

Validated locally with:

cargo fmt --all -- --check
cargo test -p a2a-lf --lib
cargo test -p a2a-websocket
cargo build --workspace

Results:

  • a2a-lf lib tests: 141 passed
  • a2a-websocket unit tests: 105 passed
  • a2a-websocket e2e tests: 8 passed
  • workspace build: passed

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the a2a-websocket crate, which implements the A2A v1 WebSocket protocol binding for both clients and servers. Key additions include a WebSocketTransport for multiplexed client requests and an axum::Router builder for serving A2A operations over persistent WebSocket connections. The reviewer identified several areas for improvement, including adding a timeout to connection attempts, implementing backpressure by replacing unbounded channels with bounded ones, and removing redundant streamEnd frames in the stream cancellation logic.

Comment thread a2a-websocket/src/client.rs Outdated
Comment thread a2a-websocket/src/client.rs Outdated
Comment thread a2a-websocket/src/server.rs Outdated
Comment thread a2a-websocket/src/server.rs
@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

❌ Patch coverage is 96.66174% with 113 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
a2a-websocket/src/server.rs 94.23% 71 Missing ⚠️
a2a-websocket/src/client.rs 96.64% 40 Missing ⚠️
a2a/src/types.rs 99.67% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

amitami2 added 7 commits May 12, 2026 08:26
Signed-off-by: amitami2 <amitami2@cisco.com>
Signed-off-by: amitami2 <amitami2@cisco.com>
Signed-off-by: amitami2 <amitami2@cisco.com>
Signed-off-by: amitami2 <amitami2@cisco.com>
Signed-off-by: amitami2 <amitami2@cisco.com>
Signed-off-by: amitami2 <amitami2@cisco.com>
Signed-off-by: amitami2 <amitami2@cisco.com>
amitami2 added 3 commits May 12, 2026 08:51
Signed-off-by: amitami2 <amitami2@cisco.com>
Signed-off-by: amitami2 <amitami2@cisco.com>
Signed-off-by: amitami2 <amitami2@cisco.com>
@hackeramitkumar hackeramitkumar marked this pull request as ready for review May 12, 2026 07:56
@hackeramitkumar hackeramitkumar requested a review from a team as a code owner May 12, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants