Pub/sub fan-out across instances
Pub/sub fan-out across instances distributes one published message to every API process with a matching active subscription. Each process independently forwards the message to its own local WebSocket hub, allowing a worker to notify customers without knowing which API instance holds their connections.
Minimal example
sub := client.PSubscribe(ctx, "user:*")
for msg := range sub.Channel() {
userID := strings.TrimPrefix(msg.Channel, "user:")
hub.SendToUser(userID, []byte(msg.Payload))
}