Send a `Text frame`_. .. _Text frame: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6 Parameters: data: payload containing text encoded with UTF-8. fin: FIN bit; set it to :obj:`False` if this is the first frame of
(self, data: BytesLike, fin: bool = True)
| 316 | self.send_frame(Frame(OP_CONT, data, fin)) |
| 317 | |
| 318 | def send_text(self, data: BytesLike, fin: bool = True) -> None: |
| 319 | """ |
| 320 | Send a `Text frame`_. |
| 321 | |
| 322 | .. _Text frame: |
| 323 | https://datatracker.ietf.org/doc/html/rfc6455#section-5.6 |
| 324 | |
| 325 | Parameters: |
| 326 | data: payload containing text encoded with UTF-8. |
| 327 | fin: FIN bit; set it to :obj:`False` if this is the first frame of |
| 328 | a fragmented message. |
| 329 | |
| 330 | Raises: |
| 331 | ProtocolError: If a fragmented message is in progress. |
| 332 | |
| 333 | """ |
| 334 | if self.expect_continuation_frame: |
| 335 | raise ProtocolError("expected a continuation frame") |
| 336 | if self._state is not OPEN: |
| 337 | raise InvalidState(f"connection is {self.state.name.lower()}") |
| 338 | self.expect_continuation_frame = not fin |
| 339 | self.send_frame(Frame(OP_TEXT, data, fin)) |
| 340 | |
| 341 | def send_binary(self, data: BytesLike, fin: bool = True) -> None: |
| 342 | """ |