socket.io-client-swift
socket.io-client-swift copied to clipboard
Socket.IO-Client-Swift version is 15.2 but connect server of socket.io version4.4.1 ,connect error
**问题是当我用同样的客户端程序连接服务端的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]"
我的核心代码 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")
}
别用这个 socket.io-client-swift 了,作者不用心,也不维护了。 Socket.io 作为 server 不错,但在 iOS 上并没有稳定可靠的 client SDK.
别用这个 socket.io-client-swift 了,作者不用心,也不维护了。 Socket.io 作为 server 不错,但在 iOS 上并没有稳定可靠的 client SDK.
有什么其他的库推荐么.