feat(iios): socket.io Redis adapter for cross-replica realtime (P9 scaling)
Adds an opt-in RedisIoAdapter (wired in main.ts when REDIS_URL is set) so socket.io room emits fan out across instances via Redis pub/sub — a client on replica B now receives messages emitted by replica A. Without REDIS_URL the in-memory adapter is kept (single-instance dev unchanged). Adds redis to docker-compose, REDIS_URL to the env contract, and smoke-realtime-cluster.mjs which proves cross-instance delivery fails without Redis and passes with it. Delivery is at-least-once at N>1; clients dedupe by message id (documented). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,5 +16,18 @@ services:
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
# Realtime fan-out across replicas (socket.io Redis adapter). Point the service at it
|
||||
# with REDIS_URL=redis://localhost:6379; without REDIS_URL the in-memory adapter is used.
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: iios-redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
volumes:
|
||||
iios_postgres_data:
|
||||
|
||||
Reference in New Issue
Block a user