uvicorn doesn't seem to pass websocket 'subprotocol' correctly back to client #1777
-
Full example demonstrating the problem is here https://github.com/villekr/uvicorn-websockets-example. python 3.10.2. During websocket connection I'm sending "websocket.accept" with specific "subprotocol" value. Looks like that uvicorn correctly gets that value and sends it to client as 'Sec-WebSocket-Protocol' header but it also sends 'sec-websocket-protocol' header with all supported subprotocols. Websockets library requires exactly one subprotocol value and therefore errors out in this situation. Is this a bug or should I use uvicorn differently? Logs from server (uvicorn with debug loglevel):
logs from client:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You aren't supposed to send the The server should be in charge of doing it. It's the subprotocol the server is able to use from the list the client proposed. |
Beta Was this translation helpful? Give feedback.
You aren't supposed to send the
Sec-Websocket-Protocol
yourself.The server should be in charge of doing it. It's the subprotocol the server is able to use from the list the client proposed.