You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/usage/testing.rst
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -148,6 +148,17 @@ We would then be able to rewrite our test like so:
148
148
:caption: tests/test_health_check.py
149
149
:language: python
150
150
151
+
Testing websockets
152
+
++++++++++++++++++
153
+
154
+
Litestar's test client enhances the httpx client to support websockets. To test a websocket endpoint, you can use the :meth:`websocket_connect <litestar.testing.TestClient.websocket_connect>`
155
+
method on the test client. The method returns a websocket connection object that you can use to send and receive messages, see an example below for json:
156
+
157
+
For more information, see also the :class:`WebSocket <litestar.connection.WebSocket>` class in the API documentation and the :ref:`websocket <usage/websockets:websockets>` documentation.
0 commit comments