-1
from socketIO_client_nexus import SocketIO, LoggingNamespace
from requests.exceptions import ConnectionError

try:
    socket = SocketIO('https://myURL/myendpoint', verify=False, wait_for_connection=False)
    socket.wait()
except ConnectionError:
    print('The server is down. Try again later.')

When I run the above code, I get the below stack trace.

enter image description here

This is a quite known issue. People who faced this issue said that it happened because the socket server that they were trying to connect to was built on socketio 2.x. However, socketIO-client-nexus 0.7.6 seems to have reportedly solved their problems. However, I'm still facing the same issue. Don't know what's wrong. The server that I'm trying to connect to is built on socketio 2.0.1

Abhilash
  • 2,667
  • 6
  • 29
  • 59

1 Answers1

0

Finally got it working. Reference https://pypi.org/project/socketIO-client-nexus/ Here's the working code.

from socketIO_client_nexus import SocketIO, BaseNamespace
class ChatNamespace(BaseNamespace):

    def custom_response(self, *args):
        print('on_custom_response', args)


    socketIO = SocketIO('https://myIP', verify=False)
    chat_namespace = socketIO.define(ChatNamespace, '/mynamespace')
    socketIO.wait()
Abhilash
  • 2,667
  • 6
  • 29
  • 59