invisibleroads / socketIO-client

A socket.io client library for Python
http://pypi.python.org/pypi/socketIO-client
MIT License
447 stars 205 forks source link

emit uplink is not working! #124

Closed gtatyous closed 8 years ago

gtatyous commented 8 years ago

Hi, I running socketIO server using node on my server side. I was able to receive downlink message from the server, however, I could not send uplink message back to the server. Could you please take a look and let me know what am I doing wrong.


from socketIO_client import SocketIO, LoggingNamespace

def on_downlink():
  print('connection established...')
  socketIO.emit('uplink') #does not work! 

with SocketIO('localhost', 8080) as socketIO:
    socketIO.on('downlink', on_downlink) #it works
    socketIO.off('stop')
    #socketIO.emit('uplink') #does not work either! 
    socketIO.wait()

Here is the node js code

server.listen(PORT, '127.0.0.1');
var socket = io.listen(server);
//socket.set('transports', ['websocket']);

socket.on('connect', 
  function () 
  {
    console.log('connected...'); //prints connected on my console log
    socket.emit('downlink'); //it works
  });

socket.on('uplink', 
  function () 
  {
    console.log('uplink...'); //can't get the uplink message
  });