문제

Running NodeJs I can see a sort of client ID:

debug - emitting heartbeat for client hg5ZurBEi8R3Ehf5kuBJ
debug - websocket writing 2::
debug - set heartbeat timeout for client hg5ZurBEi8R3Ehf5kuBJ
debug - got heartbeat packet
debug - cleared heartbeat timeout for client hg5ZurBEi8R3Ehf5kuBJ
debug - set heartbeat interval for client hg5ZurBEi8R3Ehf5kuBJ

I am using socket.io. There is a way to get "hg5ZurBEi8R3Ehf5kuBJ"? A sort of app.session_id.

도움이 되었습니까?

해결책

If you want to get it on server:

var io = require('socket.io').listen(80);

io.sockets.on('connection', function (socket) {
    console.log(socket.id); //client ID
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top