Closed ivanornes closed 7 years ago
If you want to connect directly to your server with WebSockets then do
let socket = SocketIOClient(url: NSURL(string: "http://myserver.com/")!, options: [.ForceWebsockets(true)])
Or the obj-c equivalent.
I have tried all the protocols, ws, wss, http, https with the same result.
What version of socket.io is the server using?
1.4.6
Are your url and ports correct? Because I've tested just plain socket.io servers and Forcewebsockets and it works fine.
we have a haproxy redirecting the traffic just for one node instance, does the library check the responses of the server?
You may have to connect directly to the server, I have never tested proxy stuff. I don't think the WebSocket library supports SOCKS atm. But there's a pull request that is looking to add it.
I have just check the javascript, react-native socket.io and the Android clients and all work ok
You could probably not force websockets. Since I would think NSUSRLSession would be able to handle proxy stuff.
Without forcing seems like uses polling all the time, and at some point I get the session ID unknown Got message: {"code":1,"message":"Session ID unknown"}
Correct, because it can't connect the websocket because of the proxy. That's why socket.io uses polling before it switches to Websockets. As for the unknown session ID, I have no idea about that. That shouldn't happen if the request is going to the same socket.io server and the connection hasn't been closed.
If you must have Websockets then you might have to connect directly to your server, bypassing the proxy.
I can't do that, and the strange thing is that with the javascript and Android clients just work.
They both use Websocket libraries that support SOCKS proxies I assume. You'll have to wait for the above pull request to be merged. And then I'll update the websocket library here.
I tried oldshuren's proxy-connect repo with the proxy fix and doesn't seem to work
I will try to use a react-native view as a workaround to this problem, I don´t know if the issue is in the client library or in the haproxy config
Well your url in the screenshot for the WebSocket example is wrong. It'd have to be the same as in SocketRocket.
I have a node server behind a proxy and I can connect to node's socket with Chrome's Simple WebSocket client and through an iOS simple SocketRocket client, but not with the Socket.IO swift client. The connection ends with an NSStream end encountered event (NSStreamEventEndEncountered)
I have tested it in from the 5.0.0 version up to the 6.1.2 and the last development branch.