Search code examples
websocketfastapiuvicorn

FastAPI: Error when trying to open a websocket connection after updating uvicorn


When I try to open a websocket connection to my FastAPI server, Uvicorn returns following error after I have updated it from version 0.13.4 (with this version I had no problems) to 0.15.0:

Error in opening handshake
...
websockets.legacy.handshake.check_request(headers)
AttributeError: module 'websockets' has no attribute 'legacy'

Does anyone know what this error exactly means and how to solve it?


Solution

  • when you update the version of unicorn then you need to update the version of websockets in my case I upgrade unicorn 0.13.4 to 0.14.0 and in the websockets version was 8.1 so I change this 8.1 to 10.0 and it's work

    check here for info