作者:非策不劃小子白 | 来源:互联网 | 2023-05-17 05:34
IamworkingwithiOS8andSwift.Iwanttousetheofficialsocket.ioclientbutforsomereasoni
I am working with iOS 8 and Swift. I want to use the official socket.io client but for some reason it does not attempt to connect. I followed the example given here: https://github.com/socketio/socket.io-client-swift
我正在使用iOS 8和Swift。我想使用官方socket.io客户端,但由于某种原因它不会尝试连接。我按照这里给出的例子:https://github.com/socketio/socket.io-client-swift
let socket = SocketIOClient(socketURL: "\(CurrentConfiguration.serverURL)")
socket.recOnnects= true
socket.recOnnectWait= 10
socket.nsp = "/messagelist"
// Connect
socket.connect()
socket.onAny {println("got event: \($0.event) with items \($0.items)")}
socket.on("connect") {data, ack in
println("socket connected")
}
socket.on("error") {data in
println("socket ERROR")
println(data)
}
Can anyone confirm this? Is this a version problem or maybe related to Swift 1.2?
谁能证实这一点?这是版本问题还是与Swift 1.2有关?
On the server side i cant even recognize a connection attempt. The variable serverURL is the same as i had before and
在服务器端,我甚至无法识别连接尝试。变量serverURL与之前的变量相同
2 个解决方案