I see that Flask-SocketIO only supports Python 2.x for now. Is there a way of using WebSockets (ideally within Flask) on Python3?
Flask, being a minimalist web framework, does not have WebSocket support built-in. The old Flask-Sockets extension, which has not been maintained in the last few years, provided support for this protocol.
websockets is a library for building WebSocket servers and clients in Python with a focus on correctness, simplicity, robustness, and performance. Built on top of asyncio , Python's standard asynchronous I/O framework, it provides an elegant coroutine-based API.
A WebSocket server can be written in any server-side programming language that is capable of Berkeley sockets, such as C(++), Python, PHP, or server-side JavaScript.
Now you can. Miguel's FlaskIO extension supports Python 3 since 1.0 as announced on his blog. Make sure to check PyPI in order to install one of the recent versions. At the time of writing, the last release is:
pip install flask-socketio==1.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With