socket.io: Client handshake returns error message "Transport unknown"

I was trying to initialize a handshake, following the specs I’ve found at LearnBoost/socket.io-spec. Sometime I found that it has to be done with a POST request, sometime with GET. I’ve tried both of them and they both returned the same error:

GET http://acme.local:3700/socket.io/1
or
POST http://acme.local:3700/socket.io/1

{ “code”: 0, “message”: “Transport unknown” }

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 35 (4 by maintainers)

Most upvoted comments

I’ve encountered same error on socket.io v1.1.0.

I added a follow line at server side script, then I fixed this problem. io.set('transports', ["websocket", "polling"]);

Errors I encountered:

  • GET /socket.io returns Transport unknown.
  • DEBUG=* node-dev app.js prints a lot of unknown transport polling.

I refer http://stackoverflow.com/questions/23962047/socket-io-v1-0-x-unknown-transport-polling

I fixed this problem by adding this setting to my socket.io server:

var socket = io({
  transports: [
    'websocket', 
    'flashsocket', 
    'htmlfile', 
    'xhr-polling', 
    'jsonp-polling', 
    'polling'
  ]
});

read more here: http://stackoverflow.com/a/24244413/375966

Please note that since socket.io version 1.x, the only valid values for transports are:

  • websocket
  • polling

All the other values in @afshinm 's answer won’t be used (in fact, only websocket transport will be used in that case).

It’s due to the version of socket.io. I had to downgrade to v0.9.x because I could not find any documentation about the way to perform handshake with version v1.0.x

since im also facing this , i guess its not fixed uptill now . im using “socket.io”: “^1.4.5”,

Hey, this might help, you can set the response to return plain text by setting b64=true in the request. (you also need to set the transport in the request)

For example: https://localhost:3030/socket.io/?EIO=2&transport=polling&t=1406120775060-0&b64=true

This returns (content-type:text/plain) 97:0{“sid”:“g75H5D6feFrj9cCDAAAB”,“upgrades”:[“websocket”],“pingInterval”:25000,“pingTimeout”:60000}

Also, the packet returned seems to have the following format:

In the above example Message length = 97 Type = 0 (Open) Data = {“sid”:“g75H5D6feFrj9cCDAAAB”,“upgrades”:[“websocket”],“pingInterval”:25000,“pingTimeout”:60000}

Hope it helps, but you should know I’m new to socket.io so there may be other adjustments you need to make that I’m not aware of.