Python的socketIO客户端连接,然后断开连接
我想连接我的Python脚本到我的nodejs套接字服务器。 我的代码看起来像这样 –
节点js(相关部分) –
//using socket.io@2.0.3 //PORT 8008 io.on('connection', function(socket){ console.log('connected'); socket.on('disconnect', function(){ }); socket.on('message', function incoming(message){ console.log(message); var data=JSON.parse(message); console.log(data); socket.broadcast.emit('message', message); }); });
python脚本(相关部分) –
# using socketIO_client --0.7.2 socketIO = SocketIO('localhost', 8008) socketIO.wait()
我正在连接我的控制台,但之后,我得到错误(在Python方面) –
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/socketIO_client/__init__.py", line 353, in __init__ resource, hurry_interval_in_seconds, **kw) File "/usr/local/lib/python2.7/dist-packages/socketIO_client/__init__.py", line 54, in __init__ self._transport File "/usr/local/lib/python2.7/dist-packages/socketIO_client/__init__.py", line 62, in _transport self._engineIO_session = self._get_engineIO_session() File "/usr/local/lib/python2.7/dist-packages/socketIO_client/__init__.py", line 76, in _get_engineIO_session transport.recv_packet()) StopIteration
我GOOGLEsearch相关的东西,但没有到现在。
任何解决scheme,赞赏。