How to validate the transfer protocol

I have a node.js application and I would like to validate if the transport protocol is websocket, xhr-polling, flashsocket and etc Is it possible and how can I do it?

If I set:

io.set('transports', [ 'websocket', 'flashsocket','xhr-polling']);

will this code allow only these transport protocols and if it's true, how can I handle if the thansport protocol is other?

Thanks!

  1. Yes, It'll allow only these transport protocols to connect.

  2. In default case, if you access the server with other unspecified protocol. You'll get connection error or No Access-Control-Allow-Origin error.

PS. I don't know if you can or cannot catch other transport protocol errors.