real-time-systems-architect

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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 treated as afterthoughts. This Skill provides production-grade patterns for WebSocket and SSE systems so live features are bounded, observable, and safe to reconnect from the start. ## 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 React client. - WebSocket Presence Server: Fastify-compatible presence system with JWT auth at connection time, room-based broadcast, and dead-connection reaping every 30 seconds. - Optimistic UI and Reconciliation: React useOptimistic rollback patterns plus version-stamped state reconciliation after reconnect. - Use Case: Stream BullMQ agent job progress from a SwarmX pipeline to a live dashboard, with automatic reconnect and server-state sync when the connection drops. ## 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. The client consumes the stream with EventSource and reconnects with exponential backoff on errors.

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 works over HTTP/2 and through reverse proxies. Use WebSocket only when the client also sends events, like presence heartbeats or collaborative editing.

How do I handle WebSocket reconnection and state sync?

Reconnect with exponential backoff capped at 30 seconds, then reconcile state using version-stamped server data. Never trust local client state after a disconnect; fetch the server state and apply it if its version is newer.

Does SSE work through nginx reverse proxies?

Yes, but you must set the X-Accel-Buffering: no header to disable proxy buffering and send a keep-alive ping every 15 seconds to prevent proxy timeouts. SSE also simplifies auth since it uses standard cookies over HTTP.

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 fills, drop the oldest event and log the overflow, so one slow consumer never blocks producers or other subscribers.

When should I not use WebSocket for a live feature?

Avoid WebSocket for unidirectional flows like metrics dashboards or job progress, where SSE is simpler and proxy-friendly. WebSocket adds connection management overhead that is only justified for bidirectional communication.