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

Method check

src/websockets/frames.py:334–349  ·  view source on GitHub ↗

Check that reserved bits and opcode have acceptable values. Raises: ProtocolError: If a reserved bit or the opcode is invalid.

(self)

Source from the content-addressed store, hash-verified

332 return output.getvalue()
333
334 def check(self) -> None:
335 """
336 Check that reserved bits and opcode have acceptable values.
337
338 Raises:
339 ProtocolError: If a reserved bit or the opcode is invalid.
340
341 """
342 if self.rsv1 or self.rsv2 or self.rsv3:
343 raise ProtocolError("reserved bits must be 0")
344
345 if self.opcode in CTRL_OPCODES:
346 if len(self.data) > 125:
347 raise ProtocolError("control frame too long")
348 if not self.fin:
349 raise ProtocolError("fragmented control frame")
350
351
352@dataclasses.dataclass

Callers 4

serializeMethod · 0.95
parseMethod · 0.45
parseMethod · 0.45
round_tripMethod · 0.45

Calls 1

ProtocolErrorClass · 0.85

Tested by 1

round_tripMethod · 0.36