Skip to content

feat: Real-time WebSocket Sync for Instant UI Updates #31

Description

@mjunaidca

Summary

Replace 30-second polling with WebSocket-based real-time sync so all connected clients see changes instantly.

Current State

  • Frontend polls /api/notifications every 30 seconds
  • Task changes are not visible to other users until next poll
  • Notification bell updates with delay

Proposed Architecture

┌─────────────┐     ┌─────────────┐     ┌─────────────────┐     ┌─────────────┐
│ Task        │────►│ Dapr        │────►│ WebSocket       │────►│ All Connected
│ Changed     │     │ PubSub      │     │ Service         │     │ Clients
└─────────────┘     └─────────────┘     └─────────────────┘     └─────────────┘

Implementation Steps

  • Create WebSocket service (Python/FastAPI or Node.js)
  • Subscribe to task-events topic via Dapr PubSub
  • Implement connection management (user sessions, rooms per project)
  • Broadcast events to relevant connected clients
  • Update frontend to use WebSocket connection
  • Fallback to polling when WebSocket unavailable
  • Add reconnection logic with exponential backoff

Acceptance Criteria

  • Task created by User A appears instantly for User B (same project)
  • Notification bell updates within 1 second of event
  • Works across multiple browser tabs
  • Graceful degradation to polling if WebSocket fails

Technical Notes

  • Consider Socket.IO for easier client management
  • May need sticky sessions or Redis adapter for horizontal scaling
  • Dapr subscription can directly call WebSocket service

Labels

enhancement learning event-driven phase-v2


📚 Learning Goal: Event-driven real-time architecture

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions