Skip to content

Instantly share code, notes, and snippets.

@moskrc
Last active August 29, 2015 14:07
Show Gist options
  • Save moskrc/5357838c11ae5de56d54 to your computer and use it in GitHub Desktop.
Save moskrc/5357838c11ae5de56d54 to your computer and use it in GitHub Desktop.
//FIRST SERVER (server1.js)
var io = require('socket.io')(3000);
var redis = require('socket.io-redis');
io.adapter(redis({ host: 'localhost', port: 6379 }));
var test = 0;
io.on('connection', function (socket) {
test+=1;
console.log("connection. test = " + test);
});
//SECOND SERVER (server2.js)
var io = require('socket.io')(4000);
var redis = require('socket.io-redis');
io.adapter(redis({ host: 'localhost', port: 6379 }));
var test = 0;
io.on('connection', function (socket) {
test+=1;
console.log("connection. test = " + test);
});
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment