Sends a message to the WebSocket server. If the stream is closed, raises `WebSocketClosedError`. Returns a `.Future` which can be used for flow control. .. versionchanged:: 5.0 Exception raised on a closed stream changed from `.StreamClosedError` to `W
(
self, message: Union[str, bytes, Dict[str, Any]], binary: bool = False
)
| 1484 | future_set_result_unless_cancelled(self.connect_future, self) |
| 1485 | |
| 1486 | def write_message( |
| 1487 | self, message: Union[str, bytes, Dict[str, Any]], binary: bool = False |
| 1488 | ) -> "Future[None]": |
| 1489 | """Sends a message to the WebSocket server. |
| 1490 | |
| 1491 | If the stream is closed, raises `WebSocketClosedError`. |
| 1492 | Returns a `.Future` which can be used for flow control. |
| 1493 | |
| 1494 | .. versionchanged:: 5.0 |
| 1495 | Exception raised on a closed stream changed from `.StreamClosedError` |
| 1496 | to `WebSocketClosedError`. |
| 1497 | """ |
| 1498 | if self.protocol is None: |
| 1499 | raise WebSocketClosedError("Client connection has been closed") |
| 1500 | return self.protocol.write_message(message, binary=binary) |
| 1501 | |
| 1502 | def read_message( |
| 1503 | self, |
nothing calls this directly
no test coverage detected