MCPcopy
hub / github.com/tornadoweb/tornado / ping

Method ping

tornado/websocket.py:1585–1602  ·  view source on GitHub ↗

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"")

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

utf8Function · 0.90
write_pingMethod · 0.45

Tested by

no test coverage detected