real-time-systems-architect

Implements WebSocket and SSE architectures with connection lifecycle, back-pressure, and reconnect handling.

1|Updated Aug 25, 2026
One-click install
npx skills add https://github.com/sabiscore/swarmxq --skill real-time-systems-architect-sabiscore
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: real-time-systems-architect
Source: https://github.com/sabiscore/swarmxq/tree/main/.ai/skills/real-time-systems-architect
Command: npx skills add https://github.com/sabiscore/swarmxq --skill real-time-systems-architect-sabiscore

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires bullmq, ws, ioredis.

What problem does it solve? Adding live data to an application fails in production when connection lifecycle, back-pressure, and state reconciliation after disconnect are not designed up front. This Skill provides production-grade patterns for WebSocket and SSE systems so these problems are solved architecturally before the first socket handler is written. ## Core Features & Use Cases - Transport Selection: Decision table for choosing SSE versus WebSocket based on data flow direction, covering job progress, presence, collaborative editing, and live dashboards. - SSE Implementation: Next.js route handler streaming BullMQ job progress with bounded connection caps, 15-second keep-alive pings, and exponential-backoff reconnect on the React client. - WebSocket Presence Server: Fastify-compatible presence server with JWT auth at connection time, room-based broadcast, and a 30-second dead-connection reaper. - Optimistic UI and Reconciliation: React useOptimistic rollback patterns plus version-stamped state reconciliation after reconnect. - Use Case: Stream SwarmX agent pipeline status or BullMQ job progress to a live dashboard, with slow consumers isolated via a bounded broadcaster that drops oldest events instead of blocking producers. ## Quick Start Use the real-time-systems-architect skill to stream BullMQ job progress to my Next.js dashboard over SSE with reconnect handling.

Frequently Asked Questions about real-time-systems-architect

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stream BullMQ job progress to a frontend?

Use SSE with a Next.js route handler that subscribes to BullMQ QueueEvents and pushes progress, completed, and failed events to the client. On the client, consume the stream with EventSource and reconnect with exponential backoff capped at 30 seconds.

WebSocket vs SSE: which should I use for live updates?

Choose SSE when data flows server to client only, such as job progress or dashboard metrics, since it multiplexes over HTTP/2 and works through reverse proxies. Use WebSocket only when the client also sends events, like presence heartbeats or collaborative editing.

How do I handle WebSocket authentication in a presence server?

Authenticate at connection time by extracting a JWT from the cookie or query parameter and verifying it before accepting the socket. Reject unauthorized connections with close code 1008 rather than validating per message.

Why do SSE connections drop behind nginx or proxies?

Proxies buffer or time out idle SSE streams. Send a keep-alive ping every 15 seconds and set the X-Accel-Buffering: no header so nginx disables proxy buffering for the event stream.

How do I prevent slow consumers from blocking real-time broadcasts?

Use a bounded broadcaster where each subscriber has a capped queue. When a subscriber's queue is full, drop the oldest event and log the overflow, so one slow consumer never blocks producers or other subscribers.

How do I sync client state after a WebSocket or SSE reconnect?

Never trust local state after a disconnect. Use version-stamped server state: on reconnect, fetch the latest server state and apply it whenever the server version is ahead of the client's last known version.