agentleFS
codebygarvcodebygarv/Ai-skills/skills/development/websocket-protocol-designer/SKILL.md

websocket-protocol-designer

Skill26 starsChanged 4 months agoMITView on GitHub

Designs robust real-time bidirectional WebSocket/SSE protocols with heartbeat ping/pong, reconnect backoff, and auth.

The file

Files
SKILL.md

Purpose

Architect reliable, low-overhead real-time messaging protocols over WebSockets or Server-Sent Events (SSE), incorporating connection lifecycle handshakes, heartbeat ping/pong keep-alives, exponential reconnect backoff, channel multiplexing, and reconnection state recovery.

When to Use

  • Building real-time collaborative editors, live chat, trading dashboards, or notification feeds.
  • Fixing zombie WebSocket connections that silently drop behind NAT firewalls.
  • Implementing message ordering and missed message replay after temporary disconnection.

What to Analyze

  1. Protocol Selection: WebSocket (bidirectional) vs SSE (unidirectional server-to-client with native HTTP/2 multiplexing).
  2. Frame Format: Lightweight JSON envelopes vs Binary MessagePack/Protobuf for high-frequency data.
  3. Heartbeat & Liveness: 30-second ping/pong frames to detect dead sockets through intermediate proxies.
  4. Reconnection & Catch-Up: Client reconnects with last_event_id; server streams missed events from Redis buffer.
  5. Authentication & Authorization: Ticket-based token exchange during connection handshake vs query param auth.

Output Format

  • Message Envelope JSON Schema: Standard frame format (type, channel, id, payload, ack).
  • Connection State Machine: Client connection lifecycles (CONNECTING, CONNECTED, RECONNECTING, CLOSED).
  • Server/Client Implementation Snippets: TypeScript / Node / Go socket handler with ping/pong management.

Avoid

  • Authenticating sockets by passing static JWT tokens in URL query strings (leaks into proxy access logs).
  • Missing backpressure controls when broadcasting to slow mobile clients.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.