Socket not connecting
My socket is not connecting, the version I am using is as follows Server: socket.io: "^4.6.1" Client: Socket.IO-Client-Swift 15.2.0
I am getting error as follows: LOG SocketIOClient{/}: Handling event: statusChange with data: [connecting, 2] LOG SocketIOClient{/}: Joining namespace / LOG SocketManager: Tried connecting socket when engine isn't open. Connecting LOG SocketManager: Adding engine LOG SocketManager: Manager is being released LOG SocketEngine: Starting engine. Server: https://chat.mukeshakya.com.np/ LOG SocketIOClient{/}: Client is being released LOG SocketEngine: Handshaking LOG SocketEngine: Engine is being released
Note: The socket is successfully connecting in website as well as android. Can anybody help me?
I am facing the same issue. I did the configuration similar to socket.io on android, but I can't connect.
@muk-y use this
var config = SocketIOClientConfiguration()
config.insert(.extraHeaders(["authorization" : "Bearer \(token)"]))
config.insert(.path("/socket.io/"))
config.insert(.useCustomEngine(false))
config.insert(.forceWebsockets(true))
@Crysis21 are you able to test with the latest development branch? I'm having trouble reproducing on that branch. Screenshot shows server upgrading from polling to WS
My basic test code:
func connectSocket() {
socket.connect(withPayload: ["hello": "world"])
}
manager = SocketManager(socketURL: URL(string:"http://localhost:8087/")!, config: [])
socket = manager.defaultSocket
connectSocket()
@muk-y use this
var config = SocketIOClientConfiguration() config.insert(.extraHeaders(["authorization" : "Bearer \(token)"])) config.insert(.path("/socket.io/")) config.insert(.useCustomEngine(false)) config.insert(.forceWebsockets(true))
I don't have the useCustomEngine property in Socket.IO-Client-Swift 15.2.0. Which version has the property? I have used all the codes besides useCustomEngine but the error is still the same.
@muk-y did you find any solution? I have the same issue
I have the same issue on the latest version of the library.
@muk-y did you find any solution? I have the same issue
I passed my parameters through string concatination instead of using connectParams. This solved my issue.