0

我正在使用 object-c socketio( https://github.com/pkyeck/socket.IO-objc ) 连接到我的 gevent-socketIO 服务器,它适用于我的网页。

客户

[self.socketIO connectToHost:SOCKET_URL onPort:SOCKET_PORT];

服务器

def socketio(request):
    logger.info("Connecting start")
    socketio_manage(
        request.environ,
        {'': BigSpoonNamespace, },
        request=request
    )
    logger.info("Connecting finish")
    return HttpResponse() 

DJ 日志

2014-01-25 18:21:01,499 [DEBUG] socketio.virtsocket: Spawning sub-Socket Greenlet: send_into_ws
2014-01-25 18:21:01,500 [DEBUG] socketio.virtsocket: Spawning sub-Socket Greenlet: read_from_ws
2014-01-25 18:21:01,500 [DEBUG] socketio.virtsocket: Spawning sub-Socket Greenlet: _heartbeat
2014-01-25 18:21:01,500 [DEBUG] socketio.virtsocket: Spawning sub-Socket Greenlet: _heartbeat_timeout
2014-01-25 18:21:01,502 [INFO] root: Connecting start
2014-01-25 18:22:01,525 [DEBUG] socketio.virtsocket: heartbeat timed out, killing socket
2014-01-25 18:22:01,526 [DEBUG] socketio.virtsocket: Removing sessid='64962840572' client_queue[1] server_queue[1] hits=1 from

服务器套接字 2014-01-25 18:22:01,542 [INFO] root: 连接完成

NGINX 日志

Traceback (most recent call last):
  File "/home/ec2-user/webapps/2013-final-project-7/src/backend/env/lib/python2.6/site-packages/gevent/greenlet.py", line 327, in run
    result = self._run(*self.args, **self.kwargs)
  File "/home/ec2-user/webapps/2013-final-project-7/src/backend/env/src/gevent-socketio-master/socketio/transports.py", line 259, in read_from_ws
    message = websocket.receive()
  File "/home/ec2-user/webapps/2013-final-project-7/src/backend/env/src/gevent-websocket-master/geventwebsocket/websocket.py", line 296, in receive
    result = self._receive()
  File "/home/ec2-user/webapps/2013-final-project-7/src/backend/env/src/gevent-websocket-master/geventwebsocket/websocket.py", line 273, in _receive
    raise WebSocketError('Received invalid close frame: %r %r' % (code, self.close_message))
WebSocketError: Received invalid close frame: 65535 bytearray(b'')
<Greenlet at 0x3340550: read_from_ws> failed with WebSocketError

那么这里有什么问题呢?

在客户端

- (void) socketIODidConnect:(SocketIO *)socket{}

永远不会被调用。并且程序总是在几秒钟后跳转到以下内容。

- (void) socketIODidDisconnect:(SocketIO *)socket disconnectedWithError:(NSError *)error{}  
4

1 回答 1

0

无赖!!我的 SocketIO.m 和 SRWebSocket.m 文件被修改以修复一些警告,显然这会破坏 socketIO 代码......使用原始文件后,问题得到解决。现在我想把脸砸在键盘上..

于 2014-01-26T08:20:27.283 回答