Skip to content

feat: Add WebSocket real-time feed for Block Explorer (Issue #2295)#1769

Merged
Scottcjn merged 1 commit into
Scottcjn:mainfrom
HuiNeng6:issue-2295-websocket-feed
Mar 25, 2026
Merged

feat: Add WebSocket real-time feed for Block Explorer (Issue #2295)#1769
Scottcjn merged 1 commit into
Scottcjn:mainfrom
HuiNeng6:issue-2295-websocket-feed

Conversation

@HuiNeng6
Copy link
Copy Markdown
Contributor

@HuiNeng6 HuiNeng6 commented Mar 22, 2026

Summary

Implements real-time WebSocket push functionality for the RustChain Block Explorer as specified in Issue #2295.

Features Implemented

✅ WebSocket Server Endpoint on RustChain Node

  • Added
    ode/websocket_feed.py\ - Flask-SocketIO based WebSocket server module
  • Integrates seamlessly with existing \sophia_elya_service.py\

✅ Real-time Block Feed

  • New blocks are pushed instantly to all connected clients
  • No need for manual refresh or polling
  • Block height, hash, timestamp, miner count, and reward data

✅ Live Attestation Feed

  • Miner attestations are streamed in real-time
  • Shows device architecture and multiplier
  • Epoch enrollment notifications

✅ Connection Status Indicator

  • Visual indicator in status bar (green = connected, red = disconnected)
  • Automatic status updates on connect/disconnect

✅ Auto-Reconnect

  • Client automatically reconnects on disconnect
  • Exponential backoff with max attempts (10)
  • Graceful degradation to HTTP polling if WebSocket unavailable

✅ Nginx Proxy Support

  • Updated
    ginx.conf\ with WebSocket proxy endpoints
  • Long-lived WebSocket connections supported (7 day timeout)
  • Both native WebSocket and Socket.IO endpoints configured

Bonus Features

🎉 Epoch Settlement Notifications

  • Notifications when epochs finalize
  • Total rewards and miner counts
  • Celebration-style alerts with visual distinction

📱 Responsive Design

  • Mobile-friendly notification system
  • Status indicator adapts to small screens
  • Touch-friendly close buttons

Technical Changes

File Changes
\
ode/websocket_feed.py\ NEW - WebSocket feed module with Flask-SocketIO
\
ode/sophia_elya_service.py\ Updated to broadcast blocks, attestations, and settlements
\explorer/static/js/websocket-client.js\ NEW - Frontend WebSocket client with auto-reconnect
\explorer/static/css/explorer.css\ Added WebSocket notification and status indicator styles
\explorer/index.html\ Added connection status indicator and notification container
\
ginx.conf\ Added WebSocket upstream and proxy endpoints
\docs/WEBSOCKET_FEED.md\ NEW - Comprehensive documentation

Testing

The implementation has been tested with:

  • WebSocket connection/disconnection
  • Real-time block broadcasts
  • Attestation stream
  • Epoch settlement notifications
  • Auto-reconnect on network interruption
  • Mobile responsiveness

Bounty

…#2295)

Implements real-time WebSocket push functionality for the RustChain Block Explorer.

Features:
- WebSocket server endpoint on RustChain node (node/websocket_feed.py)
- Real-time block feed (new blocks without refresh)
- Live attestation feed (miner attestations stream)
- Epoch settlement notifications (bonus feature)
- Connection status indicator in UI
- Auto-reconnect on disconnect
- Works with nginx proxy configuration

Technical Changes:
- Added websocket_feed.py module with Flask-SocketIO integration
- Updated sophia_elya_service.py to broadcast blocks, attestations, and settlements
- Added websocket-client.js for frontend WebSocket connection
- Updated explorer.css with WebSocket notification styles
- Updated index.html with connection status indicator
- Updated nginx.conf with WebSocket proxy endpoints

Bounty: 75 RTC
Issue: Scottcjn#2295
@github-actions
Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Your PR has a BCOS-L1 or BCOS-L2 label
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added size/XL PR: 500+ lines documentation Improvements or additions to documentation BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) node Node server related labels Mar 22, 2026
@Scottcjn Scottcjn merged commit 8394f90 into Scottcjn:main Mar 25, 2026
3 checks passed
@Scottcjn
Copy link
Copy Markdown
Owner

Merged! @HuiNeng6 — WebSocket feed with nginx proxy config, client JS, and explorer integration. Bounty #2295.

75 RTC. Great work. Please reply with your RTC wallet address (format: RTCxxxxxxxx, not Solana).

@HuiNeng6
Copy link
Copy Markdown
Contributor Author

@Scottcjn Thank you! I am generating my RTC wallet address now. Will provide it shortly.

@HuiNeng6
Copy link
Copy Markdown
Contributor Author

@Scottcjn Thank you! My RTC wallet address:

RTC589778251020176f64f9c1d11c4041c77dac3867

Looking forward to receiving the 75 RTC bounty! 🙏

@HuiNeng6
Copy link
Copy Markdown
Contributor Author

📢 跟进 — 75 RTC 发放

@Scottcjn

⏰ 时间线

  • PR合并时间:2026-03-25
  • 当前时间:2026-03-25 22:56 UTC+8
  • 已等待:数小时

💰 钱包地址

\
RTC589778251020176f64f9c1d11c4041c77dac3867
\\

请确认发放时间,谢谢!🙏

@Scottcjn
Copy link
Copy Markdown
Owner

Payment sent: 75 RTC → RTC589778251020176f64f9c1d11c4041c77dac3867 (pending #985)

Confirms in 24 hours. 谢谢 @HuiNeng6! Three quality merges — parasocial hooks, embed fix, WebSocket explorer. 很好的贡献者。

@Scottcjn
Copy link
Copy Markdown
Owner

@HuiNeng6 — 75 RTC paid! Would you also follow @Scottcjn? Extra 2 RTC for the follow bounty.

Copy link
Copy Markdown
Contributor

@FlintLeng FlintLeng left a comment

Choose a reason for hiding this comment

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

PR #1769 — Review (issue #2295): RustChain WebSocket Feed — real-time data streaming. Essential for block explorer and monitoring tools. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) documentation Improvements or additions to documentation node Node server related size/XL PR: 500+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants