real-time-systems-architect

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

1|Updated Sep 3, 2026
One-click install
npx skills add https://github.com/sabiscore/the-yap-engine --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/the-yap-engine/tree/main/.ai/skills/real-time-systems-architect
Command: npx skills add https://github.com/sabiscore/the-yap-engine --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 is deceptively hard: connection lifecycle management, back-pressure from slow consumers, and state reconciliation after disconnects are the problems teams most often fail to retrofit. This Skill provides production-grade patterns for WebSocket and SSE systems so these concerns are solved architecturally before the first socket handler is written. ## Core Features & Use Cases - Transport Selection Guidance: 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 a React consumer hook with exponential backoff reconnect. - WebSocket Presence Server: Fastify-compatible presence server with JWT auth at connection time, room-based broadcast, and a 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 events to a live dashboard, with capacity limits, heartbeat pings, and automatic state sync when clients reconnect. ## 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 forwards progress, completed, and failed events as SSE messages. On the client, consume the stream with EventSource in a React hook and reconnect 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 is simpler and works through reverse proxies. Use WebSocket when the client also sends events, such as presence heartbeats, chat, or collaborative editing.

How do I implement presence indicators with WebSocket?▼

Authenticate with JWT at connection time, track clients in a map keyed by connection ID, and broadcast join and leave events to room members. Run a reaper every 30 seconds to terminate connections that have not pinged within the timeout window.

Does SSE work through nginx reverse proxies?▼

Yes, but you must disable proxy buffering with the X-Accel-Buffering: no header and send keep-alive ping events every 15 seconds to prevent proxy timeouts. SSE also supports cookie-based auth, simplifying authentication compared to WebSocket.

How do I handle state after a WebSocket or SSE reconnect?▼

Never trust local client 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.

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 a warning, then flush queued batches on each tick so one slow consumer never blocks producers.