Python Forum

Full Version: python socketio-client-2 and nod js socketio server communication is not success
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,
I am trying to connect a node js socketio server using my python socketio-client. But it is not working now, because the node js socketio-serer version is changed that uses socket.io protocol 2.0 . It is a secure connection that uses ".cert" and ".key" files. The socketio client in python is already newest version which is socketIO-client-2 0.7.5 that is using socket.io protocol 1.x . I think that the connection is not made because the protocol mismatch. Please help me.

Thanks in advance! Smile
.cert and .key is unrelated to socketio, those are files used for ssh connections.  So without seeing what you're doing now, such as a small snippet of code for how you're connecting, there's not a ton we can do to help.
Hi nilamo,
I am sorry I didn't attach the code file. I added the code part for socketIO client below:

from socketIO_client import SocketIO




def on_connect():
    print ("Connected to server!!!")

def on_disconnect():
    print ("disconnected from server")

def on_reconnect():
    print ("reconnected to server")
    


if __name__ == '__main__':
    socketIO = SocketIO('https://cpnodestg.tiamd.com', cert=('certs/new_client.crt', 'certs/new_client.key'))
    #socketIO = SocketIO('http://192.168.1.250:2017')
    socketIO.on('connect', on_connect)
    socketIO.on('disconnect', on_disconnect)
    )
    socketIO.on('reconnect', on_reconnect)

    print "client created"
    socketIO.wait()
This code is working before updating the socketio version in the nodejs. But now the code is not displaying anything.