Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →websocket-patterns
Connection management, room patterns, reconnection strategies, message buffering, and binary protocol design.
Passed 5 of 24 test cases with the skill, and 2 of 24 without it.
3 fixed2 passed either way19 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
The instructions your model reads when the skill loads.
Production WebSocket patterns for real-time applications.
import { WebSocketServer, WebSocket } from 'ws'
interface Client {
id: string
ws: WebSocket
rooms: Set<string>
lastPing: number
metadata: Record<string, unknown>
}
class ConnectionManager {
private clients = new Map<string, Client>()
private heartbeatInterval: NodeJS.Timeout
constructor(private wss: WebSocketServer) {
this.heartbeatInterval = setInterval(() => this.checkHeartbeats(), 30_000)
wss.on('connection', (ws, req) => {
const clientId = crypto.randomUUID()
const client: Client = {
id: clientId,
ws,
rooms: new Set(),
lastPing: Date.now(),
metadata: { ip: req.socket.remoteAddress }
}
this.clients.set(clientId, client)
ws.on('pong', () => { client.lastPing = Date.now() })
ws.on('close', () => this.removeClient(clientId))
ws.on('error', () => this.removeClient(clientId))
this.send(client, { type: 'connected', clientId })
test cases passed, vs 2 / 24 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.