WebSocket
Bases: Protocol
WebSocket.
The Websocket instance can receive messages using an async iterator, until the connection is closed:
async for message in websocket:
...
recv()
:
message = await websocket.recv()
send()
:
await websocket.send(message)
Source code in pycrdt_websocket/websocket.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
path: str
property
The WebSocket path.
recv()
async
Receive a message.
Returns:
Type | Description |
---|---|
bytes
|
The received message. |
Source code in pycrdt_websocket/websocket.py
47 48 49 50 51 52 53 |
|
send(message)
async
Send a message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
bytes
|
The message to send. |
required |
Source code in pycrdt_websocket/websocket.py
39 40 41 42 43 44 45 |
|