Redis-based adapter for Socket.IO that enables broadcasting events between multiple Socket.IO server instances via Redis Pub/Sub. Version 8.4.6 (stable), maintained by the Socket.IO team. Ships TypeScript types. Requires socket.io-adapter ^2.4.0 peer dependency. Supports CommonJS, ES modules, and TypeScript. Key differentiator: uses two separate Redis clients (pub/sub) for reliability; supports both standard and sharded Pub/Sub (Redis 7.0+). Migration from legacy socket.io-redis package requires API changes.
npm install socket.io-redis-adapterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a Socket.IO server with Redis adapter using two Redis clients (pub/sub). Must call connect() for each client (redis@4+).
Replace require('socket.io-redis') with require('socket.io-redis-adapter') and update imports to named export createAdapter.Add await pubClient.connect() and await subClient.connect() before calling io.adapter().
Always use pubClient.duplicate() to create a separate sub client.
Switch from ioredis to redis package. If using ioredis, ensure compatibility via custom adapter options.
npm uninstall socket.io-redis && npm install socket.io-redis-adapter && change imports to 'socket.io-redis-adapter'
Check Redis client version. For redis@3: don't call connect(). For redis@4: import { createClient } from 'redis' and call client.connect(). For ioredis: use new Redis() and don't call connect().