0

in socketIO , how to check the transport type (i.e. xhr-polling or websockets or flash sockets) on which client & server communicating ? (i'm using netty server with java) thanks in advance :)

Omar Bahir
  • 1,237
  • 5
  • 20
  • 48

2 Answers2

2

On the client side, you can use the variable socket.socket.transport.name. Server-side you can use the variable socket.transport or you can check the name of the transport by connection ID.

hexacyanide
  • 88,222
  • 31
  • 159
  • 162
1

In your connection callback, the expression is io.transports[conn.id].name. As a simple test:

io.sockets.on('connection', function(conn) {
    console.log(io.transports[conn.id].name);
});
SheetJS
  • 22,470
  • 12
  • 65
  • 75