Skip to content

feat: add WebSocket streaming for real-time ledger updates - #77

Merged
SharifIbrahimDev merged 1 commit into
sharif-stellar-tools:masterfrom
Anichris-koded:feature/websocket-ledger-stream
Jun 25, 2026
Merged

SharifIbrahimDev merged 1 commit into
sharif-stellar-tools:masterfrom
Anichris-koded:feature/websocket-ledger-stream

Conversation

@Anichris-koded

Copy link
Copy Markdown
Contributor

Summary

Closes #74

Integrates a WebSocket streaming service to push new ledger and transaction events to connected clients in real-time.

Changes

  • src/hooks/useLedgerStream.ts — new hook wrapping the native WebSocket API. Manages connecting → open → closed/error lifecycle, accumulates events newest-first up to a configurable limit (default 50), and cleans up on unmount.
  • src/components/Dashboard.tsx — integrates useLedgerStream; adds a "Live Ledger Stream" panel with a live connection status indicator (● open/connecting/error/closed).
  • tests/hooks/useLedgerStream.test.ts — 15 tests covering connection lifecycle, message handling (ordering, limit, bad JSON), and WebSocket callback wiring.
  • .env.example — documents the new VITE_LEDGER_WS_URL environment variable.

Testing

  • tsc --noEmit: zero errors
  • 56/57 tests pass (1 pre-existing failure in horizonMock.test.ts unrelated to this PR)

…ellar-tools#74)

- Add useLedgerStream hook wrapping native WebSocket API
- Stream new ledger/transaction events to connected clients in real-time
- Integrate live feed panel into Dashboard with connection status indicator
- Add VITE_LEDGER_WS_URL env var (documented in .env.example)
- Add 15 tests covering connection lifecycle, message handling, and WS construction
@SharifIbrahimDev
SharifIbrahimDev merged commit 5db4b41 into sharif-stellar-tools:master Jun 25, 2026
1 check failed
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.

Add WebSocket support for real-time ledger updates

2 participants