MCPcopy Create free account
hub / github.com/python-websockets/websockets / send_pong

Method send_pong

src/websockets/protocol.py:416–430  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Calls 3

send_frameMethod · 0.95
InvalidStateClass · 0.85
FrameClass · 0.70