Python Forum
python socketio-client-2 and nod js socketio server communication is not success - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: python socketio-client-2 and nod js socketio server communication is not success (/thread-5315.html)



python socketio-client-2 and nod js socketio server communication is not success - vmyadhu2 - Sep-28-2017

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


RE: python socketio-client-2 and nod js socketio server communication is not success - nilamo - Sep-28-2017

.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.


RE: python socketio-client-2 and nod js socketio server communication is not success - vmyadhu2 - Oct-02-2017

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.