Skip to content

Instantly share code, notes, and snippets.

@TomoakiNagahara
Last active August 29, 2015 14:21
Show Gist options
  • Save TomoakiNagahara/a7b0d8194c1102f0aa18 to your computer and use it in GitHub Desktop.
Save TomoakiNagahara/a7b0d8194c1102f0aa18 to your computer and use it in GitHub Desktop.
Socket.IO を PM2 でロードバランシングしたい ref: http://qiita.com/TomoakiNagahara/items/08e327e54a6f66c3fa38
var server = app.listen(3000, function() {
});
// 0.9系のsocket.io
var io = require('socket.io').listen(server);
// 0.9系のredis
var redis = require('socket.io/lib/stores/redis');
var redisConf = { host: '127.0.0.1', port: 6379 };
// storeタイプをredisに変更
io.set('store', new redis({
redisPub: redisConf,
redisSub: redisConf,
redisClient: redisConf
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment