Skip to content

ioredis-serverlessRedis client for serverless environments

A fork of ioredis using WebSockets instead of TCP

Overview

ioredis-serverless is a fork of ioredis, the popular Redis client for Node.js. It replaces the TCP transport layer with WebSockets to enable Redis connectivity in serverless and edge environments.

Why WebSockets?

Most serverless platforms (Cloudflare Workers, Vercel Edge, etc.) do not allow raw TCP connections. They do, however, support WebSocket connections. ioredis-serverless bridges this gap by communicating with Redis over WebSockets.

WebSocket Proxy Requirement

Since Redis itself speaks TCP, a WebSocket-to-TCP proxy is required between the client and Redis server. The proxy translates WebSocket frames to Redis protocol and vice versa.

┌─────────────────┐     WebSocket     ┌─────────────┐     TCP      ┌─────────┐
│  Edge Function  │ ───────────────── │   WS Proxy  │ ──────────── │  Redis  │
└─────────────────┘                   └─────────────┘              └─────────┘

Released under the MIT License.
Redis is a trademark of Redis Ltd.