24

I'm trying to run a client an server in python using flask_socketio, socketIO_client and SOCKET.IO in a raspberry pi 4 but I'm getting the following error:

The client is using an unsupported version of the Socket.IO or Engine.IO protocols (further occurrences of this error will be logged with level INFO)
192.168.1.80 - - [05/Feb/2021 18:30:41] "GET /socket.io/?EIO=3&transport=polling&t=NTpTT-L HTTP/1.1" 400 219 0.000618

These are my current versions:

pi@raspberrypi:~/Desktop/EDAdataLogger $ npm list socket.io EDAdataLogger@ /home/pi/Desktop/EDAdataLogger └── socket.io@3.1.1

pi@raspberrypi:~/Desktop/EDAdataLogger $ npm list socket.io-client EDAdataLogger@ /home/pi/Desktop/EDAdataLogger └── socket.io-client@3.1.1

python-engineio==4.0.0
python-socketio==5.0.4
Flask==1.1.2
Flask-Session==0.3.2
Flask-SocketIO==5.0.1

How can I define JavaScript Socket.IO version and Socket.IO protocol revision so everything matches according to (https://pypi.org/project/python-socketio/) ?

How can I fix this? Thank you

stracc
  • 507
  • 1
  • 4
  • 10
  • 2
    The connection URL suggests your Socket.IO client is a version 1 or version 2. It should be a version 3 to be compatible with the Python packages that you installed. If you want the details versions 1 and 2 send `EIO=3` in the URL, while version 3 sends `EIO=4`. – Miguel Grinberg Feb 07 '21 at 23:16
  • Have you figured it out now?? – Bombosonic Oct 17 '22 at 14:33

7 Answers7

38

There appears to be some backward compatibility issues with SocketIO. You can uninstall python-engineio, python-socketio (and Flask-SocketIO just to be on the safe side) and reinstall lower versions.

The combination that worked for me was:

Flask-SocketIO==4.3.1
python-engineio==3.13.2
python-socketio==4.6.0
Joel Oduro-Afriyie
  • 1,563
  • 14
  • 13
22

To fix the version incompatibility, you can run below "upgrade"commands:

pip install --upgrade python-socketio==4.6.0

pip install --upgrade python-engineio==3.13.2

pip install --upgrade Flask-SocketIO==4.3.1
Ravi Pullagurla
  • 466
  • 4
  • 10
3

flask-socketio-5.1.2 python-engineio-4.3.2 python-socketio-5.6.0

script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/4.5.0/socket.io.js">

This worked for me. This error is due to dependency related to python-engineio . After this, check your socket request shows EIO4 like this "GET /socket.io/?EIO=4&transport=websocket&sid=mJ1g8wm0didssJSiAAAA HTTP/1.1" 200

2

Check for the compatibility between the JS Client version and the Socket.IO server version here: https://socket.io/docs/v4/client-installation/ and accordingly upgrade/downgrade the client/server version.

You will need these modules on the server side:
Flask-SocketIO
python-engineio
python-socketio

You will have this kind of URL in your client: //cdnjs.cloudflare.com/ajax/libs/socket.io/

One working example, which I'm using:

On Server side:
Flask-SocketIO==5.2.0
python-engineio==4.3.3
python-socketio==5.7.1
simple-websocket==0.7.0

On Client side:
//cdnjs.cloudflare.com/ajax/libs/socket.io/4.2.0/socket.io.js

Khushhal
  • 645
  • 11
  • 18
1

My fix was to use the socket.io version, not cloudflare as the source

Ryder R
  • 11
  • 4
  • 3
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 20 '22 at 18:56
1

You are using The JavaScript client version 1.4.8, from about 6 years ago: https://www.npmjs.com/package/socket.io-client/v/1.4.8.

I strongly recommend that you upgrade your Socket.IO client to the latest 4.x versions, but if that cannot be helped, then the Flask-SocketIO documentation clearly tells you what versions of the Python packages to use:

Socket.IO version compatibility table

Miguel Grinberg
  • 65,299
  • 14
  • 133
  • 152
  • Thank you for your kind answer. The method you gave me was done beforehand Even though java socketio ran with a version that was released five days ago, The same problem has occurred Once again, I will test it after installing the package to match the java socket 1.x version Thank you. – moon se ji Oct 20 '22 at 10:04
0

my fix was to use socket io itself as source not cloudfare <script>src="https://cdn.socket.io/4.6.0/socket.io.min.js" integrity="sha384-c79GN5VsunZvi+Q/WObgk2in0CbZsHnjEqvFxC5DxHn9lTfNce2WW6h2pH6u/kF+" crossorigin="anonymous"</script>

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 14 '23 at 20:16