---
name: "socket-io-rooms-binary-events"
description: "Build bi-directional, resilient event-driven WebSocket applications using Socket.IO."
metadata:
  author: "Socket.IO"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "create socket.io room"
  - "broadcast to room socket.io"
  - "redis adapter socket.io cluster"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Socket.IO Real-Time Rooms, Namespaces & Binary Streams

Architects real-time communication with Socket.IO: configuring rooms and namespaces, broadcasting events, client reconnection strategies with exponential backoff, binary buffer transfers, and Redis Streams adapter for clustering.

## When to Invoke
Invoke this skill whenever you need to:
- create socket.io room
- broadcast to room socket.io
- redis adapter socket.io cluster

## Execution SOP & Rules
1. Initialize server: const io = new Server(server, { cors: { origin: '*' } }).
2. Join rooms: socket.join(`room_${roomId}`) and emit: io.to(`room_${roomId}`).emit('new_message', msg).
3. Scale cluster: attach @socket.io/redis-adapter with redis clients for cross-node broadcasts.
4. Handle connection disconnections: socket.on('disconnect', () => { ... }) with clean resource cleanup.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
