socket.io-client-swift icon indicating copy to clipboard operation
socket.io-client-swift copied to clipboard

WebSocket doesn't connect through proxy

Open ivanornes opened this issue 9 years ago • 11 comments

Hi to the socket.io community,

I am trying to connect my app to a socket.io server, behind an elb and a haproxy. The configuration with the sockets should be ok because the web and android clients are already upgrading to websockets.

The connection fallbacks to polling all the time, and I get multiple connect events and sometimes I still get Session ID unknown errors. This happens when the server sends a 500 error and the app tries to reconnect, receiving error 400.

The strange thing is that as soon as I launch the app, I get an endEncountered event in the public func stream(_ aStream: Stream, handle eventCode: Stream.Event) function in the WebSocket.swift file, even if I don´t force the websockets.

captura de pantalla 2016-07-13 a las 10 48 58

The issue is happening with the 6.1.4 and the swift 3 versions of the socket.io-client-swift. The version in the servers socket.io should be the 1.4.8 or 1.4.7.

Thanks

ivanornes avatar Jul 13 '16 09:07 ivanornes

This is because the websocket library does not yet support tunneling through proxies. There's an open pull request that adds support for it, but until then it will continue to fail.

https://github.com/daltoniam/Starscream/pull/202

nuclearace avatar Jul 13 '16 13:07 nuclearace

Thanks @nuclearace I just tried @oldshuren's socket.io-client-swift fork with proxy connect and almost works. At least I can see the wss connection even if the server is closing it.

captura de pantalla 2016-07-13 a las 16 01 20

ivanornes avatar Jul 13 '16 14:07 ivanornes

Hm, I haven't (and probably won't) had time to set up a test setup. But once that pull request is merged and I update the dependency I'll look into a little bit more.

nuclearace avatar Jul 13 '16 14:07 nuclearace

I also will try to make it work, thanks!

ivanornes avatar Jul 13 '16 14:07 ivanornes

Any updates on this issue?

Dwar3xwar avatar Aug 19 '16 17:08 Dwar3xwar

hi, any update or pull is merged or not ? Its long time now on this Issue

QaiserAbbas avatar Sep 28 '17 11:09 QaiserAbbas

Any updates on this issue? I see it "on hold" For a scalable use of socket.io it's almost a mandatory enhancement to use a load balancer (proxy), the alternatives are painful.

jlgl10nes avatar Mar 15 '18 17:03 jlgl10nes

It's still blocked by the WebSocket dependency.

nuclearace avatar Mar 15 '18 17:03 nuclearace

Any updates?

megamingus avatar Apr 11 '19 19:04 megamingus

So um... real talk... is this actually still an issue in 2000 freaking 23?

slumtrimpet avatar Feb 07 '23 04:02 slumtrimpet

Bad proxy, no issue in the library

ivanornes avatar Feb 07 '23 06:02 ivanornes