Send a `Pong frame`_. .. _Pong frame: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.3 Parameters: data: payload containing arbitrary binary data.
(self, data: BytesLike)
| 414 | self.send_frame(Frame(OP_PING, data)) |
| 415 | |
| 416 | def send_pong(self, data: BytesLike) -> None: |
| 417 | """ |
| 418 | Send a `Pong frame`_. |
| 419 | |
| 420 | .. _Pong frame: |
| 421 | https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.3 |
| 422 | |
| 423 | Parameters: |
| 424 | data: payload containing arbitrary binary data. |
| 425 | |
| 426 | """ |
| 427 | # RFC 6455 allows control frames after starting the closing handshake. |
| 428 | if self._state is not OPEN and self._state is not CLOSING: |
| 429 | raise InvalidState(f"connection is {self.state.name.lower()}") |
| 430 | self.send_frame(Frame(OP_PONG, data)) |
| 431 | |
| 432 | def fail(self, code: CloseCode | int, reason: str = "") -> None: |
| 433 | """ |