これは、 https: //github.com/fent/socket.io-clusterhubを使用してクラスタープロセスごとに実行されます。
var store = new (require('socket.io-clusterhub'));
var io = require('socket.io').listen(config.ports.socket);
io.configure(function(){
io.set('store',store);
});
console.log('Socket service listening on port '+config.ports.socket);
io.sockets.on('connection',function(socket){
if(typeof fn === 'function'){fn(socket);}
});
しかし、4つのスレッドすべてが同じユーザーを異なるソケットIDで登録しようとしているようです。
debug: client authorized
info: handshake authorized XEGx6zAP7rSWGQcaxmUB
debug: client authorized
info: handshake authorized r0Vcr7Z-r_9MnylyxmUC
debug: client authorized
info: handshake authorized 7RWUgoCuZPIu0IyQxmUj
debug: client authorized
info: handshake authorized mq0zKCgeDkisr-rbxmUk
次に、完全に切断します。
debug: setting request GET /socket.io/1/websocket/XEGx6zAP7rSWGQcaxmUB
debug: set heartbeat interval for client XEGx6zAP7rSWGQcaxmUB
debug: websocket writing 7:::1+0
warn: client not handshaken client should reconnect
info: transport end (error)
debug: set close timeout for client XEGx6zAP7rSWGQcaxmUB
debug: cleared close timeout for client XEGx6zAP7rSWGQcaxmUB
debug: cleared heartbeat interval for client XEGx6zAP7rSWGQcaxmUB
debug: discarding transport
debug: setting request GET /socket.io/1/websocket/r0Vcr7Z-r_9MnylyxmUC
debug: set heartbeat interval for client r0Vcr7Z-r_9MnylyxmUC
debug: setting request GET /socket.io/1/websocket/7RWUgoCuZPIu0IyQxmUj
debug: set heartbeat interval for client 7RWUgoCuZPIu0IyQxmUj
debug: websocket writing 7:::1+0
warn: client not handshaken client should reconnect
info: transport end (error)
debug: set close timeout for client 7RWUgoCuZPIu0IyQxmUj
debug: cleared close timeout for client 7RWUgoCuZPIu0IyQxmUj
debug: cleared heartbeat interval for client 7RWUgoCuZPIu0IyQxmUj
debug: discarding transport
r0Vcr7Z-r_9MnylyxmUC
また、まだアクティブであるかのように動作し続けても、コールバックルーチンの実行にまったく失敗します。
debug: cleared heartbeat timeout for client r0Vcr7Z-r_9MnylyxmUC
debug: set heartbeat interval for client r0Vcr7Z-r_9MnylyxmUC
debug: emitting heartbeat for client r0Vcr7Z-r_9MnylyxmUC
debug: websocket writing 2::
debug: set heartbeat timeout for client r0Vcr7Z-r_9MnylyxmUC
debug: got heartbeat packet
debug: cleared heartbeat timeout for client r0Vcr7Z-r_9MnylyxmUC
debug: set heartbeat interval for client r0Vcr7Z-r_9MnylyxmUC
debug: emitting heartbeat for client r0Vcr7Z-r_9MnylyxmUC
debug: websocket writing 2::
debug: set heartbeat timeout for client r0Vcr7Z-r_9MnylyxmUC
debug: got heartbeat packet
debug: cleared heartbeat timeout for client r0Vcr7Z-r_9MnylyxmUC
debug: set heartbeat interval for client r0Vcr7Z-r_9MnylyxmUC
debug: emitting heartbeat for client r0Vcr7Z-r_9MnylyxmUC
debug: websocket writing 2::
debug: set heartbeat timeout for client r0Vcr7Z-r_9MnylyxmUC
debug: got heartbeat packet
debug: cleared heartbeat timeout for client r0Vcr7Z-r_9MnylyxmUC
debug: set heartbeat interval for client r0Vcr7Z-r_9MnylyxmUC
debug: emitting heartbeat for client r0Vcr7Z-r_9MnylyxmUC
何か案は?ありがとう!