Socket.IO Redis Adapter
Scale Socket.IO across multiple server instances by broadcasting events through Redis
Repository Health
Technical Analysis
@socket.io/redis-adapter is the official Socket.IO adapter that lets a single logical Socket.IO deployment span multiple Node.js server processes. By default, Socket.IO can only broadcast events to sockets connected to the same process; this adapter uses Redis Pub/Sub (or Redis’s newer sharded Pub/Sub for cluster mode) to relay emit() calls, room management, and acknowledgements across every server node, so clients connected to different instances still see each other’s real-time events.
It supports both the redis and ioredis client packages, standalone Redis and Redis Cluster topologies, and — since Socket.IO 4.1+ — inter-server communication features like broadcast acknowledgements and remote socket management. The README includes an explicit security notice: Redis Pub/Sub traffic is unauthenticated and unencrypted by the adapter itself, so Redis must be treated as trusted internal infrastructure, not exposed to untrusted networks.
What You Get
createAdapter(pubClient, subClient)for the standard Pub/Sub-based adapter, compatible with bothredisandioredisclientscreateShardedAdapter()for Redis 7.0+ sharded Pub/Sub, designed to scale Pub/Sub usage in Redis Cluster deployments- Support for Redis Cluster topologies via
createCluster/Clusterclient configuration on either side - Inter-server broadcast acknowledgements and remote socket management (since adapter 7.0.0 / Socket.IO 4.1.0+)
- Configurable options (
key/channelPrefix,requestsTimeout,subscriptionMode) for tuning channel naming and cross-node request behavior
Common Use Cases
- Horizontally scaling a Socket.IO-based real-time application across multiple Node.js server processes or containers
- Running a chat or notification system behind a load balancer where clients may land on different backend instances
- Coordinating room membership and presence across a multi-node Socket.IO deployment during rolling deploys or autoscaling
- Migrating a growing Socket.IO app from a single-process deployment to a horizontally scaled architecture without changing application-level event code
Under The Hood
Architecture - The core implementation in lib/index.ts (~950 lines) extends Socket.IO’s base Adapter class, overriding broadcast, room-management, and acknowledgement methods to additionally publish serialized packets to Redis channels and process incoming messages from subscribed channels on other nodes. lib/sharded-adapter.ts implements a parallel adapter built on Redis’s sharded Pub/Sub (SSUBSCRIBE/SPUBLISH) introduced in Redis 7.0, which distributes Pub/Sub load across cluster shards instead of a single channel. lib/util.ts centralizes packet encoding/decoding shared by both adapters.
Tech Stack - Written entirely in TypeScript, published with compiled type declarations, and designed to work with either of the two dominant Node.js Redis clients (redis and ioredis) rather than bundling its own — the adapter only needs a pub/sub-capable client instance passed in.
Code Quality - Tests under test/ (index.ts, specifics.ts, custom-parser.ts, util.ts) run against a real Redis instance provisioned via the included docker-compose.yml, exercising actual pub/sub behavior rather than mocked Redis calls — an appropriate choice given how state- and timing-sensitive cross-node broadcast logic is. A compatibility table in the README explicitly maps adapter major versions to supported Socket.IO server versions, showing deliberate attention to avoiding breaking changes for existing deployments.
API Design - Integration is a single line — pass createAdapter(pubClient, subClient) (or createShardedAdapter) into the Socket.IO Server constructor’s adapter option — with all further usage identical to single-process Socket.IO code, so application logic doesn’t need to change when scaling out. The explicit security notice in the README about treating Redis as trusted infrastructure is a notable, responsible piece of documentation often missing from comparable adapters.
Used by 12 apps in this directory
Activepieces
Automation · AI Assistants
Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.
AFFiNE
Productivity · Project Management · Note Taking
Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.
APITable
Low Code Platforms · Databases
API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.
Budibase
Low Code Platforms · No Code Platforms
Build AI agents, automations, and internal apps on a single open-source platform with full self-hosting control.
ChartBrew
Analytics · Databases
Open-source reporting platform to build live dashboards from SQL, NoSQL, APIs, and SaaS tools with an AI assistant that creates charts from natural language.
Docmost
Productivity · Note Taking · Collaboration
Self-hosted collaborative wiki and knowledge base with real-time editing, diagrams, AI assistance, and enterprise access controls — a modern alternative to Confluence and Notion.
Hexabot
AI Development · Automation
Build and run agentic workflows across channels with YAML, tools, and RAG
NocoDB
No Code Platforms · Databases · Low Code Platforms
Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.
NodeBB
Community
Modern Node.js forum software with real-time WebSockets, multi-database support, and a plugin ecosystem — the community platform built for the open web and the Fediverse.