MCPcopy Create free account
hub / github.com/EasyIME/PIME / ping

Method ping

python/python3/tornado/websocket.py:426–445  ·  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 ``websocket_ping_i

(self, data: Union[str, bytes] = b"")

Source from the content-addressed store, hash-verified

424 raise NotImplementedError
425
426 def ping(self, data: Union[str, bytes] = b"") -> None:
427 """Send ping frame to the remote end.
428
429 The data argument allows a small amount of data (up to 125
430 bytes) to be sent as a part of the ping message. Note that not
431 all websocket implementations expose this data to
432 applications.
433
434 Consider using the ``websocket_ping_interval`` application
435 setting instead of sending pings manually.
436
437 .. versionchanged:: 5.1
438
439 The data argument is now optional.
440
441 """
442 data = utf8(data)
443 if self.ws_connection is None or self.ws_connection.is_closing():
444 raise WebSocketClosedError()
445 self.ws_connection.write_ping(data)
446
447 def on_pong(self, data: bytes) -> None:
448 """Invoked when the response to a ping frame is received."""

Callers 1

test_manual_pingMethod · 0.45

Calls 4

utf8Function · 0.90
is_closingMethod · 0.45
write_pingMethod · 0.45

Tested by 1

test_manual_pingMethod · 0.36