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

Method check

src/websockets/frames.py:418–427  ·  view source on GitHub ↗

Check that the close code has a valid value for a close frame. Raises: ProtocolError: If the close code is invalid.

(self)

Source from the content-addressed store, hash-verified

416 return struct.pack("!H", self.code) + self.reason.encode()
417
418 def check(self) -> None:
419 """
420 Check that the close code has a valid value for a close frame.
421
422 Raises:
423 ProtocolError: If the close code is invalid.
424
425 """
426 if not (self.code in EXTERNAL_CLOSE_CODES or 3000 <= self.code < 5000):
427 raise ProtocolError("invalid status code")
428
429
430# At the bottom to break import cycles created by type annotations.

Callers 1

serializeMethod · 0.95

Calls 1

ProtocolErrorClass · 0.85

Tested by

no test coverage detected