websocket/_abnf.py
The _abnf.py file
- class websocket._abnf.ABNF(fin: int = 0, rsv1: int = 0, rsv2: int = 0, rsv3: int = 0, opcode: int = 1, mask_value: int = 1, data: str | bytes | None = '')[source]
ABNF frame class. See http://tools.ietf.org/html/rfc5234 and http://tools.ietf.org/html/rfc6455#section-5.2
- __init__(fin: int = 0, rsv1: int = 0, rsv2: int = 0, rsv3: int = 0, opcode: int = 1, mask_value: int = 1, data: str | bytes | None = '') None [source]
Constructor for ABNF. Please check RFC for arguments.
- static create_frame(data: bytes | str, opcode: int, fin: int = 1) ABNF [source]
Create frame to send text, binary and other data.
- Parameters:
data (str) – data to send. This is string value(byte array). If opcode is OPCODE_TEXT and this value is unicode, data value is converted into unicode string, automatically.
opcode (int) – operation code. please see OPCODE_MAP.
fin (int) – fin flag. if set to 0, create continue fragmentation.