I am using Flask and SocketIO. I am getting 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) on my Flask console.

Here are my versions:

bidict==0.22.1
click==8.1.3
colorama==0.4.6
Flask==2.2.2
Flask-SocketIO==5.3.6
h11==0.14.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.1
numpy==1.25.1
opencv-python==4.8.0.74
python-engineio==4.8.0
python-socketio==5.10.0
simple-websocket==1.0.0
six==1.16.0
Werkzeug==2.2.2
wsproto==1.2.0

At the end of my body in HTML, I have these lines:

<script src="/socket.io/socket.io.js"></script>
<script type="module" src="{{url_for('static', filename='js/video.js')}}"></script>

At the top of my video.js file, I have this line:

import io from '/socket.io/socket.io.js';
var socket = io();

In my Flask project, which I have organized as a package, I have these lines in init.py:

app = Flask(__name__)
app.debug = True
socketio = SocketIO(app)

Additionally, I have a file called run.py, which contains the following:

from mypackage import app, socketio

if __name__ == '__main__':
    socketio.run(app)

I have tried downgrading to socketio version 4.3.2 which simply causes a Werkzeug error compatibility issue for some odd reason.

I have looked online for a lot of solutions that have not helped.

It is my understanding that the socket.io.js file is being generated by the Flask socketio so it should be automatically compatible?

I tried looking into the Javascript file in developer tools. When accessing the link in by copying the url http://127.0.0.1:5000/socket.io/socket.io.js, I merely get a text body of "The client is using an unsupported version of the Socket.IO or Engine.IO protocols".

I have spent close to 3 hours on this issue already. Please help.

1

There are 1 answers

0
Miguel Grinberg On

The error is pretty clear: "The client is using an unsupported version of ...". The problem is that the version of your client here:

<script src="/socket.io/socket.io.js"></script>

is incompatible with the version of the server here:

python-engineio==4.8.0
python-socketio==5.10.0

So first determine what version of the client you have, then look at the version compatibility table in the documentation to make sure you are using a set of compatible versions across client and server.