express.io
express.io copied to clipboard
I'm trying to return socket id
Hi, today I tried to use express.io module for the first time and I like it. It's really extended part of socket.io and express.js. But I have a problem. I'm trying to return socket.id in app.io.route event, how can I get client unique id using express.io?
I tried to parse some data and I can handle unique id, but I don't think that my way is perfect to find unique id. So there is my code to detect socket id:
app.io.route('debug', function(socket) {
console.log( first(app.io.sockets.sockets) );
});
function first(obj) {
for (var a in obj) return a;
}