MCPcopy Index your code
hub / github.com/websocket-client/websocket-client / send_close

Method send_close

websocket/_core.py:487–501  ·  view source on GitHub ↗

Send close data to the server. Parameters ---------- status: int Status code to send. See STATUS_XXX. reason: str or bytes The reason to close. This must be string or UTF-8 bytes.

(self, status: int = STATUS_NORMAL, reason: bytes = b"")

Source from the content-addressed store, hash-verified

485 return self.frame_buffer.recv_frame()
486
487 def send_close(self, status: int = STATUS_NORMAL, reason: bytes = b""):
488 """
489 Send close data to the server.
490
491 Parameters
492 ----------
493 status: int
494 Status code to send. See STATUS_XXX.
495 reason: str or bytes
496 The reason to close. This must be string or UTF-8 bytes.
497 """
498 if status < 0 or status >= ABNF.LENGTH_16:
499 raise ValueError("code is invalid range")
500 self.connected = False
501 self.send(struct.pack("!H", status) + reason, ABNF.OPCODE_CLOSE)
502
503 def close(self, status: int = STATUS_NORMAL, reason: bytes = b"", timeout: int = 3):
504 """

Callers 2

recv_data_frameMethod · 0.95
recvFunction · 0.80

Calls 1

sendMethod · 0.95

Tested by

no test coverage detected