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

@hackeramitkumar hackeramitkumar commented May 5, 2026

Copy link
Copy Markdown

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

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

Copy link
Copy Markdown

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

codecov Bot commented May 10, 2026

Copy link
Copy Markdown

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
88plug added a commit to 88plug/a2a-rs that referenced this pull request Jun 24, 2026
Adopt the WebSocket transport (new a2a-websocket crate: client + server +
common + errors + e2e tests) from upstream PR a2aproject#63, rebased
onto the current tree: brought in the self-contained crate + supporting
a2a/types + proto, regenerated the protobuf rather than merging generated
code, and merged the workspace deps.

Fixed 4 server tests whose unknown-field payloads ({"bogus":true}, etc.) no
longer error now that ProtoJSON ignores unknown fields per spec §5.7 (cherry
a2aproject#81) — switched them to malformed non-object payloads so they still exercise
the INVALID_PARAMS path. 105 unit + 8 integration tests pass; clippy clean.

Co-authored-by: amitami2 <amitami2@cisco.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: ss <andrew@88plug.com>
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