Implementation of socket.io store using node's native cluster messaging
Strong-cluster-socket.io-store is an implementation of socket.io store using node's native cluster messaging. It provides an easy solution for running socket.io server in a node cluster.
$ npm install strong-cluster-socket.io-store
var io = require'socket.io';var ClusterStore = require'strong-cluster-socket.io-store'io;if clusterisMaster// Setup your master and fork workers.else// Start a socket.io server, configure it to use ClusterStore.iolistenport store: ;// etc.
The store requires that a shared-state server is running in the master process.
The server is initialized automatically when you require() this module
from the master. In the case that your master and workers have separate source
files, you must explicitly require this module in your master source file.
Optionally, you can call
setup() to make it more obvious why you are loading
a module that is not used anywhere else.
// master.jsvar cluster = require'cluster';// etc.require'strong-cluster-socket.io-store'setup;// configure your cluster// fork the workers// etc.