socketio / socket.io-client-swift

Other
5.21k stars 841 forks source link

Socket.IO-Client-Swift version is 15.2 but connect server of socket.io version4.4.1 ,connect error #1404

Open feilila opened 2 years ago

feilila commented 2 years ago

**问题是当我用同样的客户端程序连接服务端的socket.io 版本是2.3.1 是 一切都没有问题。 但是当服务端的socket.io版本是4.4.1时就,客户端报如下错误,好像是握手失败。

The problem is when I use the same client program to connect to the server of socket.io version is 2.3.1, so everything is OK. But when upgrade socket.io version to 4.4.1 , the client will report the following error, as if the handshake failed.** " 2022-03-02 22:23:05.032546+0800 testSocketio[14588:429977] LOG SocketEngine: Starting engine. Server: http://139.9.42.3:8051/ 2022-03-02 22:23:05.032738+0800 testSocketio[14588:429977] LOG SocketEngine: Handshaking 2022-03-02 22:23:05.034836+0800 testSocketio[14588:429977] LOG SocketEnginePolling: Doing polling GET http://139.9.42.3:8051/socket.io/?transport=polling&b64=1 2022-03-02 22:23:05.221624+0800 testSocketio[14588:429973] ERROR SocketEnginePolling: Error during long poll request 2022-03-02 22:23:05.221818+0800 testSocketio[14588:429973] ERROR SocketEngine: Error 2022-03-02 22:23:05.222007+0800 testSocketio[14588:429762] ERROR SocketManager: Error 2022-03-02 22:23:05.222255+0800 testSocketio[14588:429762] LOG SocketIOClient{/chat}: Handling event: error with data: ["Error"] 2022-03-02 22:23:05.222494+0800 testSocketio[14588:429762] LOG SocketManager: Starting reconnect 2022-03-02 22:23:05.222642+0800 testSocketio[14588:429762] LOG SocketManager: Trying to reconnect 2022-03-02 22:23:05.222796+0800 testSocketio[14588:429762] LOG SocketIOClient{/chat}: Handling event: reconnectAttempt with data: [-1]"

feilila commented 2 years ago

我的核心代码 My core code:

class ViewController: UIViewController {

var manager : SocketManager?
var socket : SocketIOClient?

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view.
    print("in testSocket")

   // manager = SocketManager(socketURL: URL(string:"http://myip:8051/")!, config: [.log(true),.forceWebsockets(true),.connectParams(["me" : "teacherLee","talkto":"zsj","token":"123"])])
    //socket = manager!.defaultSocket
    manager = SocketManager(socketURL: URL(string:"http://myip:8051/")!,config: [.log(true)])
    socket = manager!.socket(forNamespace: "/chat")

    socket!.on(clientEvent: .connect) {data, ack in
        print("socket connected")
    }

    socket!.connect()
    print("end testSocket")
}
ldbfrank commented 2 years ago

别用这个 socket.io-client-swift 了,作者不用心,也不维护了。 Socket.io 作为 server 不错,但在 iOS 上并没有稳定可靠的 client SDK.

shywoody commented 10 months ago

别用这个 socket.io-client-swift 了,作者不用心,也不维护了。 Socket.io 作为 server 不错,但在 iOS 上并没有稳定可靠的 client SDK.

有什么其他的库推荐么.