Published

Testing WebSockets

FastAPI framework, high performance, easy to learn, fast to code, ready for production We just scratched the surface, but you already get the idea of how it all works...

Testing WebSockets

You can use the same TestClient to test WebSockets.

For this, you use the TestClient in a with statement, connecting to the WebSocket:

{!../../../docs_src/app_testing/tutorial002.py!}

!!! note For more details, check Starlette's documentation for testing WebSockets.