Skip to content

Conversation

@andresilva
Copy link
Collaborator

@andresilva andresilva commented Oct 28, 2025

This PR adds a WebSocket reporter for the simplex consensus engine that streams real-time consensus activities as binary over the network. The reporter uses a broadcast channel with two components: a WebSocketReporter that implements the Reporter trait and can be passed to the consensus engine, and a separate consumable WebSocketServer actor that handles the actual WebSocket connections. When clients connect, they first receive a context message containing participant information followed by a continuous stream of Activity messages. The implementation requires a tokio runtime and uses tokio-tungstenite for the WebSocket server.

Related #1921.

Copy link
Contributor

Choose a reason for hiding this comment

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

Pondering where the best place is to put these "stock" reporters. Admittedly, it feels very right to put here (although I don't love that this crate knows about tokio)...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe we could have a consensus-extras crate? Although it probably makes sense to keep AttributableReporter in consensus?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess the TUI could go in consensus-extras as well.

@cloudflare-workers-and-pages
Copy link

Deploying monorepo with  Cloudflare Pages  Cloudflare Pages

Latest commit: af1322f
Status: ✅  Deploy successful!
Preview URL: https://0f77eb8c.monorepo-eu0.pages.dev
Branch Preview URL: https://andre-simplex-websocket-repo.monorepo-eu0.pages.dev

View logs

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.33%. Comparing base (ad0b3bf) to head (af1322f).
⚠️ Report is 7 commits behind head on main.

@@            Coverage Diff             @@
##             main    #2030      +/-   ##
==========================================
- Coverage   92.35%   92.33%   -0.02%     
==========================================
  Files         313      313              
  Lines       83834    83808      -26     
==========================================
- Hits        77426    77387      -39     
- Misses       6408     6421      +13     
Files with missing lines Coverage Δ
consensus/src/simplex/config.rs 68.57% <ø> (-0.18%) ⬇️
consensus/src/simplex/mod.rs 98.59% <100.00%> (-0.04%) ⬇️
consensus/src/simplex/reporters/attributable.rs 98.80% <ø> (ø)
consensus/src/simplex/signing_scheme/mod.rs 71.01% <ø> (ø)
consensus/src/simplex/types.rs 89.61% <ø> (ø)

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad0b3bf...af1322f. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants