help wanted
仓库指标
- Star
- (3 star)
- PR 合并指标
- (PR 指标待抓取)
描述
Objective
Provide a real-time voting experience (live updates) for proposal voting and results using websockets (Socket.io for Node.js or SignalR for .NET).
Description
When members vote, other group members should see the updated tally and vote counts in near-real-time. This requires a websocket layer that pushes vote events, finalization events, and status changes from backend to connected clients. It should be scalable and respect authentication & authorization (only members of the group receive updates).
Key Tasks
- Add websocket server:
- Node.js: Socket.io server integrated with NestJS/Express
- .NET: SignalR hub integrated into ASP.NET app
- Define real-time channels/rooms by
groupIdandproposalId - Emit events:
vote_cast→ broadcast incremental tally and recent voter (obfuscated if privacy required)proposal_finalized→ final result + tx hash (if on-chain)proposal_update→ status changes (started/ended)
- Ensure authentication:
- Validate JWT on connection and join only allowed rooms
- Implement debounce/throttle logic to avoid event flooding
- Add client-side sample (Android or web) demonstrating socket connection and real-time UI update
- Add tests for concurrent votes (simulate multiple clients)
Acceptance Criteria
- Socket server authenticates connections and joins correct rooms
- Voting from one client updates all connected clients within <1s (network dependent)
- Events include enough context: proposalId, new counts, time remaining
- On finalize, clients receive final result and backend logs the finalization action
- Rate limiting / throttling implemented to protect from spam
Tech Notes / Suggestions
- Use Redis adapter for Socket.io if scaled across multiple nodes
- Secure websockets with TLS in production
- For mobile: implement a lightweight client that reconnects reliably and handles network drops
Labels
realtime, backend, feature, scalability