You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While there's been some effort in adding websocket routing support, there are still a couple of things that are missing:
When the server receives a ws:// or wss:// request, it still creates a MapAdapter() instance that is configured to handle HTTP, so the only way to match a WebSocket route is to manually pass websocket=True in the match() call. If the incoming request has the Connection: Upgrade and Upgrade: WebSocket headers in it, then it is a WebSocket request, so the MapAdapter should be initialized to match WebSocket by default.
To be able to implement WebSocket, the route handler function needs to take control of the underlying socket, so that it can do the WebSocket handshake, send the 101 response and then start sending/receiving WebSocket frames. Gunicorn handles this by adding the gunicorn.socket key to the environ dictionary. Werkzeug could add a werkzeug.socket key to expose its socket.
Adding solutions to the above problems would allow a Werkzeug or Flask application to implement a WebSocket route, for example using wsproto.
The text was updated successfully, but these errors were encountered: