Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

socket.io from v1.0.x return error on handshake #47

Closed
Maxwell2022 opened this issue Jun 2, 2014 · 16 comments
Closed

socket.io from v1.0.x return error on handshake #47

Maxwell2022 opened this issue Jun 2, 2014 · 16 comments

Comments

@Maxwell2022
Copy link

When enabling curl verbose during the handshake I can see that socket.io is returning an HTTP 400:

* Adding handle: conn: 0x7fd781809000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 1 (0x7fd781809000) send_pipe: 1, recv_pipe: 0
* About to connect() to acme.local port 3700 (#1)
*   Trying 127.0.0.1...
* Connected to acme.local (127.0.0.1) port 3700 (#1)
> GET /socket.io/1 HTTP/1.1
Host: acme.local:3700
Accept: */*

< HTTP/1.1 400 Bad Request
< Content-Type: application/json
< Date: Mon, 02 Jun 2014 01:39:33 GMT
< Connection: keep-alive
< Transfer-Encoding: chunked
< 
* Connection #1 to host acme.local left intact

Directly hitting the nodejs server in the browser:
http://acme.local:3700/socket.io/1

{
    code: 0,
    message: "Transport unknown"
}

I think it's missing some parameters in the handshake query. I'm using the master branch. I'll try to switch to 2.0.x to see if it change something.

@Maxwell2022
Copy link
Author

It's working on my stage server, not on my local server

@pawski
Copy link

pawski commented Jun 8, 2014

I get same error with socket.io 1.0.4.

@Maxwell2022 Maxwell2022 changed the title socket.io v1.0.2 return error on handshake socket.io from v1.0.x return error on handshake Jun 9, 2014
@Maxwell2022
Copy link
Author

Handshake is different from 1.0.0. I had an old version in local.

@Niksac
Copy link

Niksac commented Jun 11, 2014

Same issue here for 1.0.4, any workaround ?

@MathieuDoyon
Copy link

I also get the same issue

@jthomaschewski
Copy link

Same issue here. Would be great to see an update soon

@guillaumepotier
Copy link
Member

Hi there,

Thanks for using elephant.io and for opening this issue. It seems that socket.io 1.x changed a bit its payload and that elephant is currently running only for 0.x socket.io versions.

We planned to take time to support it properly during july. Please be patient or submit a PR to help us before we have time to have a closer look to that.

Thanks a lot

@johnlogsdon
Copy link

This may help you, I posted it to stackoverflow in response to someone else with a similar issue.
http://stackoverflow.com/questions/23946683/socket-io-bad-request-with-response-code0-messagetransport-unknown

@thoranrion
Copy link

Here is a quick fix in Client.php line 331:

    $sess = json_decode(substr($res,5));
    $this->session['sid'] = $sess -> sid;
    $this->session['heartbeat_timeout'] = $sess -> pingInterval;
    $this->session['connection_timeout'] = $sess -> pingTimeout;
    $this->session['supported_transports'] = array_flip($sess -> upgrades);

@gmajoulet
Copy link
Contributor

Thanks for your fix.

It removes the error, since Socketio1.x doesn't allow websocket connections first. You have to connect through a polling connection, and then upgrade to websocket, if supported.

However, they changed many things in the way they handle their communications, by switching to Engineio. Even if it removes the error, you won't be able to send any message. The current Elephantio implementation is meant to work with Socketio 0.9.x, and needs a huge refactoring to work with Socketio 1.x.

We tried working on it but found no "quick fix", and planned refactoring the lib within a few weeks

@lalmat
Copy link

lalmat commented Jul 26, 2014

I made a pulling request with a quick fix. Tell me if it's good.

@sroze
Copy link

sroze commented Jul 31, 2014

Hey @guillaumepotier, what about the support planed in July ? :)

@guillaumepotier
Copy link
Member

Ahah, nice reminder @sroze ;)

Like every project planning and management, we experienced some delays :) But @Taluu is starting 3.0 refacto / branch right now, and have exactly 5 working days to achieve that (after it would be me during my holidays :p)

Thanks to @lalmat I think the task will be easier for us ;)

Best

@sroze
Copy link

sroze commented Jul 31, 2014

Which way do you want to manage its implementation ? By using the Client's protocol parameter ? Create an 0.x branch for the current code and 1.0 support only on the master branch ?

@guillaumepotier 5 working days seams great for the community ! :)

@Taluu
Copy link
Contributor

Taluu commented Jul 31, 2014

See my comment on @lalmat's pull request : #53 (comment)

The idea would be to have several "engines" which decide how to speak with the target (Socket.io 0.x, Socket.io 1.x, ... etc).

@Taluu
Copy link
Contributor

Taluu commented Aug 18, 2014

Closing, as Elephant 3 now supports Socket.io 3.0. A "true" stable release should be available during the month.

@Taluu Taluu closed this as completed Aug 18, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests