Replace the in-memory PubSub with a Redis-backed RedisPubSub from graphql-redis-subscriptions. RedisPubSub requires two separate Redis connections — one for publishing and one for subscribing. Events published by any instance are broadcast to all instances, which fan them out to their connected WebSocket clients.
In-memory PubSub only works within a single process — events are not shared across instances.
RedisPubSub broadcasts events across all instances over a shared Redis channel.
Two separate Redis clients are required — Redis protocol restricts a subscribed client from publishing.
All NestJS instances subscribe to the same Redis channel and fan out events to their WebSocket clients.
For very high throughput consider Kafka or RabbitMQ instead of Redis pub/sub.