Send custom data along with handshakeData in socket.io?

前端 未结 7 1246
迷失自我
迷失自我 2020-11-28 02:18

So I have an application running node js with socket.io as a backend and normal javascript as frontend. My application has a login system which currently simply has the clie

相关标签:
7条回答
  • 2020-11-28 02:58

    This my code for sending query data to nodejs and server.io server client.

    var socket = io.connect(window.location.origin, { query: 'loggeduser=user1' });
    
    io.sockets.on('connection', function (socket) {
        var endp = socket.manager.handshaken[socket.id].address;
        console.log("query... " + socket.manager.handshaken[socket.id].query.user);
    }
    
    0 讨论(0)
提交回复
热议问题