
Websocket Engineer
Choose and implement real-time channels—WebSocket, SSE, long polling, HTTP/2 push, or WebRTC—for chat, feeds, and live updates in your backend.
Overview
Websocket Engineer is an agent skill for the Build phase that guides protocol choice and server patterns for real-time communication including WebSocket and SSE.
Install
npx skills add https://github.com/jeffallan/claude-skills --skill websocket-engineerWhat is this skill?
- Comparison matrix for WebSocket, SSE, long polling, HTTP/2 Push, and WebRTC across bidirectionality, overhead, and proxy
- SSE guidance for one-way feeds with automatic reconnection and simpler firewall compatibility
- Express-style SSE server example with event-stream headers and client disconnect cleanup
- Clear when-to-use cues: chat/games vs notifications/tickers vs legacy long polling
- 5 transport options compared in a single feature matrix
Adoption & trust: 4.2k installs on skills.sh; 9.7k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need live updates in your app but are unsure whether WebSockets, SSE, or polling fit your directionality, proxies, and browser support.
Who is it for?
Indie builders adding notifications, live feeds, or chat to a Node or similar backend who want a decision table before writing connection code.
Skip if: Pure static sites with no server push, or teams that already standardized on a managed realtime SaaS with no custom protocol work.
When should I use this skill?
Implementing or choosing real-time server-to-client or bidirectional communication for a product feature.
What do I get? / Deliverables
You implement a matched transport with appropriate headers, connection lifecycle handling, and a documented tradeoff against alternatives in the comparison table.
- Chosen protocol with rationale from the comparison table
- Server handler pattern (e.g. SSE or WebSocket route) adapted to your app
Recommended Skills
Journey fit
Transport and server patterns for live data are implemented during Build on the backend, not at idea or launch time. Backend subphase is the canonical shelf for protocol choice, headers, connection lifecycle, and server handlers.
How it compares
Protocol selection and sample handlers—not a managed Pusher/Ably integration skill or a full WebRTC signaling tutorial.
Common Questions / FAQ
Who is websocket-engineer for?
Solo developers building SaaS or APIs who must implement server-to-client or bidirectional realtime themselves in Claude Code, Cursor, or Codex.
When should I use websocket-engineer?
During Build backend work when designing routes for chat, games, live metrics, or notification streams and comparing SSE versus WebSocket versus polling.
Is websocket-engineer safe to install?
It is documentation-style patterns without bundled binaries; review the Security Audits panel on this Prism page before letting an agent expose open CORS or unauthenticated event endpoints.
SKILL.md
READMESKILL.md - Websocket Engineer
# Real-Time Communication Alternatives ## Technology Comparison | Feature | WebSocket | SSE | Long Polling | HTTP/2 Push | WebRTC | |---------|-----------|-----|--------------|-------------|--------| | Bidirectional | Yes | No | Yes | No | Yes | | Real-time | Yes | Yes | Near | Yes | Yes | | Browser Support | Excellent | Good | Universal | Good | Good | | Proxy Issues | Some | Rare | Rare | Some | Some | | Overhead | Low | Low | High | Medium | Medium | | Use Case | Chat, games | Feeds, updates | Legacy | Assets | Audio/video | ## Server-Sent Events (SSE) ### When to Use SSE - One-way server-to-client communication - Live feeds, notifications, stock tickers - Automatic reconnection needed - Simpler than WebSockets - Better firewall/proxy compatibility ### SSE Server (Node.js) ```javascript const express = require('express'); const app = express(); app.get('/events', (req, res) => { // Set SSE headers res.setHeader('Content-Type', 'text/event-stream'); res.setHeader('Cache-Control', 'no-cache'); res.setHeader('Connection', 'keep-alive'); res.setHeader('Access-Control-Allow-Origin', '*'); // Send initial connection message res.write('data: {"message": "Connected"}\n\n'); // Send updates every 5 seconds const intervalId = setInterval(() => { const data = { timestamp: Date.now(), value: Math.random() }; res.write(`data: ${JSON.stringify(data)}\n\n`); }, 5000); // Cleanup on client disconnect req.on('close', () => { clearInterval(intervalId); res.end(); }); }); app.listen(3000); ``` ### SSE Client ```javascript const eventSource = new EventSource('http://localhost:3000/events'); eventSource.onmessage = (event) => { const data = JSON.parse(event.data); console.log('Received:', data); }; eventSource.onerror = (error) => { console.error('SSE error:', error); // Automatically reconnects }; // Named events eventSource.addEventListener('update', (event) => { console.log('Update:', event.data); }); // Close connection eventSource.close(); ``` ### SSE with Express ```javascript const express = require('express'); const app = express(); class SSEManager { constructor() { this.clients = new Set(); } addClient(res) { this.clients.add(res); } removeClient(res) { this.clients.delete(res); } broadcast(event, data) { const message = `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`; this.clients.forEach(client => { client.write(message); }); } } const sseManager = new SSEManager(); app.get('/events', (req, res) => { res.setHeader('Content-Type', 'text/event-stream'); res.setHeader('Cache-Control', 'no-cache'); res.setHeader('Connection', 'keep-alive'); sseManager.addClient(res); req.on('close', () => { sseManager.removeClient(res); }); }); // Broadcast to all clients setInterval(() => { sseManager.broadcast('update', { timestamp: Date.now(), activeClients: sseManager.clients.size }); }, 10000); app.listen(3000); ``` ## Long Polling ### When to Use Long Polling - Legacy browser support needed - Firewall/proxy blocks WebSockets - Very infrequent updates - Fallback mechanism ### Long Polling Server ```javascript const express = require('express'); const app = express(); const pendingRequests = new Map(); const messages = []; app.get('/poll', (req, res) => { const clientId = req.query.clientId; // If messages available, send immediately if (messages.length > 0) { res.json({ messages }); messages.length = 0; // Clear messages return; } // Hold request until timeout or new message const timeout = setTimeout(() => { pendingRequests.delete(clientId); res.json({ messages: [] }); }, 30000); // 30 second timeout pendingRequests.set(clientId, { res, timeout }); req.on('close', () => { clearTimeout(timeout); pendingRequests.delete(clientId); }); }); app.post('/send', express.json(), (req, res) => { messages.push(req.body.mes