Send ping frame to the remote end. The data argument allows a small amount of data (up to 125 bytes) to be sent as a part of the ping message. Note that not all websocket implementations expose this data to applications. Consider using the ``ping_interval``
(self, data: bytes = b"")
| 1583 | return self.read_queue.put(message) |
| 1584 | |
| 1585 | def ping(self, data: bytes = b"") -> None: |
| 1586 | """Send ping frame to the remote end. |
| 1587 | |
| 1588 | The data argument allows a small amount of data (up to 125 |
| 1589 | bytes) to be sent as a part of the ping message. Note that not |
| 1590 | all websocket implementations expose this data to |
| 1591 | applications. |
| 1592 | |
| 1593 | Consider using the ``ping_interval`` argument to |
| 1594 | `websocket_connect` instead of sending pings manually. |
| 1595 | |
| 1596 | .. versionadded:: 5.1 |
| 1597 | |
| 1598 | """ |
| 1599 | data = utf8(data) |
| 1600 | if self.protocol is None: |
| 1601 | raise WebSocketClosedError() |
| 1602 | self.protocol.write_ping(data) |
| 1603 | |
| 1604 | def on_pong(self, data: bytes) -> None: |
| 1605 | pass |
nothing calls this directly
no test coverage detected