“在服务器上出现未知错误......”在Swift上使用Socket.io

时间:2016-07-15 14:22:12

标签: ios swift xcode sockets socket.io

我正在尝试连接到我的Xcode Server的内部socket.io。我用这个初始化客户端:

self.socket.connect()

但是当我使用2016-07-15 16:13:49.179 MyApp[84260:1941316] LOG SocketIOClient: Adding handler for event: connect 2016-07-15 16:13:49.180 MyApp[84260:1941316] LOG SocketIOClient: Adding handler for event: integrationStatus 2016-07-15 16:13:49.180 MyApp[84260:1941316] LOG SocketIOClient: Adding handler for event: advisoryIntegrationStatus 2016-07-15 16:13:49.180 MyApp[84260:1941316] LOG SocketIOClient: Adding engine 2016-07-15 16:13:49.181 MyApp[84260:1941316] LOG SocketEngine: Starting engine. Server: https://37.203.216.82 2016-07-15 16:13:49.181 MyApp[84260:1941316] LOG SocketEngine: Handshaking 2016-07-15 16:13:49.182 MyApp[84260:1941792] LOG SocketEnginePolling: Doing polling request 2016-07-15 16:13:49.317 MyApp[84260:1941792] LOG SocketEnginePolling: Got polling response 2016-07-15 16:13:49.322 MyApp[84260:1941786] LOG SocketEngine: Got message: Welcome to socket.io. 2016-07-15 16:13:49.324 MyApp[84260:1941786] ERROR SocketIOClient: Got unknown error from server Welcome to socket.io. 2016-07-15 16:13:49.326 MyApp[84260:1941786] LOG SocketIOClient: Handling event: error with data: ( "Got unknown error from server Welcome to socket.io." ) 时,我得到了这个回复:

socket.io.js

我尝试更改xcode/internal/socket.io/1/文件或Welcome to socket.io的路径,但它们都给出了相同的响应,而{{1}}被替换为该文件的内容。< / p>

3 个答案:

答案 0 :(得分:0)

尝试将#' subsets to list aSubset <- lapply(1:5, FUN = function(X){ eval(parse(text = sprintf("subset(data, AD%d == 1)", X))) }) #' assuming your original data came from a data.frame, colNames <- c('u','v','w','x','z') #' for each list element, calculate column means. I suggest modifying #' the output to the structure you want, i.e. by using llply or etc require(plyr) adMeans <- ldply(aSubset, function(x){ colMeans(x[, colNames]) }) #' for a clearer output, these might be useful: colnames(adMeans) <- colNames rownames(adMeans) <- sprintf('AD%d', 1:5) 作为协议,如下所示:

ws

答案 1 :(得分:0)

在服务器端和客户端检查socket.io版本,两者不匹配可能是导致此错误的原因

答案 2 :(得分:0)

我已将 swift 客户端框架更新到最新的 16.0.1 版本。但是这个错误发生了。还有一个未解决的问题:https://github.com/socketio/socket.io-client-swift/issues/1355

我通过恢复到旧的稳定版本来解决这个问题:

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