1

I am trying to connect my python script to my nodejs socket server. My code looks like this-

node js (relevant part)-

//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 script (relevant part)-

# using socketIO_client --0.7.2
socketIO = SocketIO('localhost', 8008)
socketIO.wait()

I am getting connecting in my console but after that, I am getting error (on python side) -

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

I googled and searched for related stuff but nothing till now.

Any approach to solution is appreciated.

aquaman
  • 1,523
  • 5
  • 20
  • 39

1 Answers1

1

I found a solution for this problem here: https://github.com/invisibleroads/socketIO-client/issues/159

Try to change the socket.io version of nodejs from 2.0.3 to 1.7.2