79818688

Date: 2025-11-13 10:00:09
Score: 1.5
Natty:
Report link

Based on the code you've shared,the client sends a single "join dashboard" message on connect (via socket.emit('dashboard-socket', { dbID: dashboardId })), and after that, it's purely server-to-client updates. No ongoing bidirectional communication, no client-initiated actions—just efficient, targeted pushes to subscribed dashboards. If that's accurate, you're overkill-ing it with Socket.IO. The full WebSocket stack adds unnecessary overhead: handshakes, pings, room management, and framing for two-way comms you don't need. I'd strongly recommend switching to Server-Sent Events (SSE) instead. SSE is designed exactly for this streaming one-way updates from server to browser over a long-lived HTTP connection. It's simpler, lighter, auto-reconnects on drops, and scales beautifully with your existing Redis Pub/Sub setup. No more looping over all sockets or global emits; just track active connections per dashboard and fan out precisely.

usefull reccourses : https://stackoverflow.com/questions/16096780/server-sent-events-with-multiple-users https://www.reddit.com/r/webdev/comments/149bjod/how_is_barely_anyone_talking_about_the_serversent/

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Rayan Allali