【发布时间】:2017-05-13 07:38:05
【问题描述】:
我正在使用 SocketIO,一切正常,例如连接,将数据从 iOS 发送到 Android,但是当 android 将数据发送到 iOS 设备时,未调用套接字 io 事件处理程序方法。我看过下面的日志,但没有调用方法。
LOG SocketEngine: Writing poll: has data: false
LOG SocketEnginePolling: Sending poll: as type: 2
LOG SocketEnginePolling: Created POST string: 1:2
LOG SocketEnginePolling: POSTing
LOG SocketEnginePolling: Doing polling request
LOG SocketEnginePolling: Got polling response
LOG SocketEnginePolling: Doing polling request
LOG SocketEngine: Got message: 3
代码片段:
socket.connect()
socket.on("connect") {data, ack in
if Id > 0 {
SocketIOManager.sharedInstance.connectToServerWithId(String(Id), completionHandler: {
(userList) -> Void in
})
}
}
socket.on("result") { (dataArray, socketAck) -> Void in
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "receivedResultNotification"), object: dataArray[0] as! [String: AnyObject])
}
任何对我有用的帮助。
【问题讨论】: