Redis adapter
Every packet that is sent to multiple clients (e.g. or socket.broadcast.emit()
) is:
- sent to all matching clients connected to the current server
- published in a Redis channel, and received by the other Socket.IO servers of the cluster
The source code of this adapter can be found here.
Installation
Or with :
Options
- Do I still need to enable sticky sessions when using the Redis adapter?
Yes. Failing to do so will result in HTTP 400 responses (you are reaching a server that is not aware of the Socket.IO session).
More information can be found .
Emitter
The Redis emitter allows sending packets to the connected clients from another Node.js process:
This emitter is also available in several languages:
- Javascript:
- Java: https://github.com/sunsus/socket.io-java-emitter
- Python:
- PHP: https://github.com/rase-/socket.io-php-emitter
- Golang:
- Rust: https://github.com/epli2/socketio-rust-emitter
Usage
Caught a mistake? Edit this page on GitHub