title: FastAPI websocket can not connect
body: <p>I am trying to let my Vue.js app communicate with my FastAPI(based on starlette) local server using websockets. I tried using the exact same code as in their example: <a href="https://fastapi.tiangolo.com/tutorial/websockets/" rel="nofollow noreferrer">https://fastapi.tiangolo.com/tutorial/websockets/</a>. However something weird happens, because my server can not start with the reason: <code>AttributeError: 'FastAPI' object has no attribute 'websocket'</code>. That is strange because this exact code is the official docs of FastAPI.<br>
  After that I used the Starlette example code: <a href="https://www.starlette.io/websockets/" rel="nofollow noreferrer">https://www.starlette.io/websockets/</a>. However when I try to connect to it, the FastApi prints to the terminal: <code>WARNING: Invalid HTTP request received.</code><br>
  I tried using another client, the Simple WebSocket Client: <a href="https://chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo" rel="nofollow noreferrer">https://chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo</a>, but the same error appears on the terminal.<br>
  What am I doing wrong here? In the first place I find it weird that the FastAPI code does not seem to work on my computer, does anyone know why?</p>
  
  <p>Thanks in advance!</p>