Send custom data along with handshakeData in socket.io?

前端 未结 7 1274
迷失自我
迷失自我 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:37

    For socket.io v1.2.1 use this:

    io.use(function (socket, next) {
      var handshake = socket.handshake;
      console.log(handshake.query);
      next();
    });
    

提交回复
热议问题