Socket IO | How to get the client transport type on the serverside?

后端 未结 7 744
梦谈多话
梦谈多话 2021-01-01 23:51

I need to know what transport method a client is using for some conditional statements on the nodeJS serverside.

Does anyone know how I can get that

7条回答
  •  迷失自我
    2021-01-02 00:14

    In socket.io 0.7.6

    io.sockets.on('connection', function(client) {
        console.log(io.transports[client.id].name);
    });
    

提交回复
热议问题