Implementation of store using node's native cluster messaging

npm install
1 downloads in the last day
6 downloads in the last week
46 downloads in the last month Store for Cluster

Build Status NPM version

Overview is an implementation of store using node's native cluster messaging. It provides an easy solution for running server in a node cluster.


  • No dependencies on external services.
  • Module is shipped without, it will use your version of
  • Covered by unit-tests.

WARNING's implementation has a race condition that allows the client to send the websocket request to another worker before that worker has processed the notification about a successful handshake. See

You have to enable session affinity (sticky sessions) in your load-balancer to get your server working in the cluster.



$ npm install


var io = require('');
var ClusterStore = require('')(io);

if (cluster.isMaster) {
  // Setup your master and fork workers.
} else {
  // Start a server, configure it to use ClusterStore.
  io.listen(port, { store: new ClusterStore() });
  // etc.

Setting up the master process

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.js

var cluster = require('cluster');
// etc.


// configure your cluster
// fork the workers
// etc.
npm loves you