socketio / socket.io-client-swift

Other
5.19k stars 836 forks source link

[iOS] SocketEngine does not conform to protocol WebSocketDelegate #1495

Open mobifly-dev opened 1 month ago

mobifly-dev commented 1 month ago

Hello,

could you add to the SocketEngine this code. The XCode has a problem without delegate compatibility during compilation and he does not respect the SocketEngine extension in line 762 for some reason.

public func didReceive(event: Starscream.WebSocketEvent, client _: Starscream.WebSocketClient) {
        switch event {
            case let .connected(headers):
                wsConnected = true
                client?.engineDidWebsocketUpgrade(headers: headers)
                websocketDidConnect()
            case .cancelled:
                wsConnected = false
                websocketDidDisconnect(error: EngineError.canceled)
            case let .disconnected(reason, code):
                wsConnected = false
                websocketDidDisconnect(error: nil)
            case let .text(msg):
                parseEngineMessage(msg)
            case let .binary(data):
                parseEngineData(data)
            case _:
                break
        }
    }
bumios commented 1 week ago

I'm facing the same problem, after I ran pod install or pod update, the Starscream was being updated to 4.0.8 causing this issue. Back to the old Podfile.lock when it works when Starscream version (4.0.4).

Using: Socket.IO-Client-Swift (16.0.1) My pod file:

pod 'Socket.IO-Client-Swift', '~> 16.0.0'

image

sanketk2020 commented 1 week ago

Hi Starscream v(4.0.8) is causing this issue, to solve it, Simply open your Podfile.lock file in text editor and then find the - Starscream (4.0.8) and change it's version 4.0.8 to 4.0.4 and save it and close it. And then open terminal and in that run pod install command.

And that issue will be fixed.

From - Starscream (4.0.8)

to - Starscream (4.0.4)