MCPcopy Index your code
hub / github.com/python-websockets/websockets / send_ping

Method send_ping

src/websockets/protocol.py:400–414  ·  view source on GitHub ↗

Send a `Ping frame`_. .. _Ping frame: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.2 Parameters: data: payload containing arbitrary binary data.

(self, data: BytesLike)

Source from the content-addressed store, hash-verified

398 self.state = CLOSING
399
400 def send_ping(self, data: BytesLike) -> None:
401 """
402 Send a `Ping frame`_.
403
404 .. _Ping frame:
405 https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.2
406
407 Parameters:
408 data: payload containing arbitrary binary data.
409
410 """
411 # RFC 6455 allows control frames after starting the closing handshake.
412 if self._state is not OPEN and self._state is not CLOSING:
413 raise InvalidState(f"connection is {self.state.name.lower()}")
414 self.send_frame(Frame(OP_PING, data))
415
416 def send_pong(self, data: BytesLike) -> None:
417 """

Calls 3

send_frameMethod · 0.95
InvalidStateClass · 0.85
FrameClass · 0.70