Private Network Configuration
The clustering method provides the alternative of running the communication between nodes without having to deal with a third-party channel like Redis Pub/Sub. The protocol is, in fact, decentralized.
SOKETI_ADAPTER_DRIVER=cluster soketi start
No matter how many soketi processes you open with the Cluster driver, you will have built-in scalability without additional servers. It's highly recommended to use the cluster adapter when you deploy soketi behind the same private network with PM2 to acquire multithreading.
The only downside to the cluster adapter is that you can only scale processes or instances which are within the same network. The protocol used is tied to a hostname which should be the same for all instances. This can be highly effective when deploying to Kubernetes clusters or behind the firewall, in the same network. To deploy in multi-mesh architectures, consider using Redis Pub/Sub.
These environment variables are working only when the
ADAPTER_DRIVERvariable is set to
Make sure to choose the same port and hostname if you want the nodes to communicate between each other properly. Deploying multi-tenant architectures should use different ports or hostnames.
Beside scaling horizontally, that can be done by configuring the Redis adapter, each running instance of soketi is able to communicate with other nodes that run in the same private network via the IPC protocol in Node.js.