title: FastAPI websocket ping/pong timeout
body: <p>I am using FastAPI with <code>@app.websocket</code> to listen for incoming websockets. How does FastAPI (or Starlette or Uvicorn underneath) do ping/pong heartbeats? Is this configurable? I cannot find it in the documentation at all.</p>
  <pre><code>from fastapi import FastAPI, WebSocket
  
  app = FastAPI()
  
  @app.websocket(&quot;/&quot;)
  def ws(websocket: WebSocket):
      pass
  </code></pre>
  <p><code>fastapi</code> uses <code>starlette</code>, and under the hood it seems to use <code>websockets</code>. <code>websockets.connect</code> by default uses a <code>ping_interval</code> and <code>ping_timeout</code> of 20 seconds, but I can't tell if that is used in FastAPI.</p>