Open rouzbeh-abadi opened 1 year ago
Hello) Not sure what it is but still - in our project we try to use Socket.IO on servers and client sides. Server on c++ and we had as I remember similar issues in IOS/Swift - can't connect / connection broker. Android connected ok, IOS not. We migrate to uwebsocket library - https://github.com/uNetworking/uWebSockets/blob/master/misc/READMORE.md?ysclid=l874d105io565424393
and use in Swift native WebSockets/NSURLSession and all works fine
Hello,
In logs, it was using transport polling as you can see below, we need to enable the websockets instead:
Doing polling POST https://
So, to resolve the issue, please add .forceWebsockets(true) to config like this :
manager = SocketManager(socketURL: url!, config: [.forceWebsockets(true), .log(true), .reconnects(true), .reconnectAttempts(3)])
If it doesn't work, then try using server socket.IO version 3.x.x instead of the new v4.5.2 socket.IO and client version 16.0.1. Then it should work.
Hope it will fix the issue. 😀
Hi, to make a connection to v4.5.2 socket.IO in a node.js server, I updated swift client from version 15.2.0 to version 16.0.1 The new v4.5.2 socket.IO works perfectly well with the java and Android client, but there are two issues on swift client that I'm dealing with them now:
1- The transport is always set to polling. In order to fix it, I set
.forceWebsockets(true)
, but it is not possible to make an establish a connection after it. It's our first priority to fix this issue. The transport should be set to webcocket Here is the logs2- The second issue is, if more than one iOS devices makes a connection, all devices will be disconnected.
Here the swift code:
Your help will be appreciated