using the `requests` library.
```python
-from starlette import HTMLResponse, TestClient
+from starlette.response import HTMLResponse
+from starlette.testclient import TestClient
class App:
def test_app():
client = TestClient(App)
- with client.wsconnect('/') as session:
+ with client.websocket_connect('/') as session:
data = session.receive_text()
assert data == 'Hello, world!'
```
#### Establishing a test session
-* `.wsconnect(url, subprotocols=None, **options)` - Takes the same set of arguments as `requests.get()`.
+* `.websocket_connect(url, subprotocols=None, **options)` - Takes the same set of arguments as `requests.get()`.
May raise `starlette.websockets.Disconnect` if the application does not accept the websocket connection.
+#### Sending data
+
+* `.send_text(data)` - Send the given text to the application.
+* `.send_bytes(data)` - Send the given bytes to the application.
+* `.send_json(data)` - Send the given data to the application.
+
#### Receiving data
* `.receive_text()` - Wait for incoming text sent by the application and return it.