Skip to content

feat: add WebSocket transaction streamer service#5

Open
gitteri wants to merge 1 commit into
mainfrom
feat/ws-streamer
Open

feat: add WebSocket transaction streamer service#5
gitteri wants to merge 1 commit into
mainfrom
feat/ws-streamer

Conversation

@gitteri

@gitteri gitteri commented Feb 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • New streamer binary in core/src/bin/streamer.rs that provides real-time WebSocket streaming of escrow and withdrawal transaction events.
  • Polls two Postgres databases (accountsdb for escrow deposits/releases, indexer DB for withdraw transactions) and broadcasts parsed events to all connected WebSocket clients.
  • Supports configurable poll intervals, CORS, ping/pong keep-alive, and graceful shutdown.
  • Adds axum (with ws feature) and tower-http (with cors feature) as workspace dependencies.

Changed files

  • Cargo.toml -- workspace deps for axum and tower-http
  • Cargo.lock -- dependency resolution
  • core/Cargo.toml -- add axum and tower-http
  • core/src/bin/streamer.rs -- 759-line streamer service

Test plan

  • cargo build -p contra-core --bin streamer compiles
  • Streamer connects to Postgres and starts polling
  • WebSocket clients receive transaction events in real-time
  • Ping/pong keep-alive prevents stale connections
  • Graceful shutdown on SIGINT/SIGTERM

Made with Cursor

New binary that streams transaction events over WebSocket connections.
Polls accountsdb and indexer databases, broadcasts escrow and withdraw
events to connected clients. Adds axum and tower-http workspace deps.
gitteri pushed a commit that referenced this pull request May 21, 2026
* fix(gateway): add 64KB request body size limit

Gateway read unbounded POST bodies into memory, risking OOM under
large payloads.

Two-layer defense:
- Content-Length pre-check: reject >64KB with 413 before reading bytes
- Limited wrapper: enforces cap for chunked/missing Content-Length

Error downcast distinguishes LengthLimitError (413) from genuine IO
errors (400) so error semantics stay correct. Unparseable Content-Length
headers are logged as warnings. 413 responses include a JSON-RPC error
body with the limit for client debuggability.

Includes five tests: oversized Content-Length, oversized chunked body,
exact 64KB boundary, lying Content-Length bypass, and normal request
passthrough.

Refs: PRO-890

* refactor(gateway): move start_test_gateway into mod tests

---------

Co-authored-by: Jo D <dev-jodee@users.noreply.github.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.

1 participant