alexapy.aiohttp.http_websocket

WebSocket protocol versions 13 and 8.

Classes

class alexapy.aiohttp.http_websocket.WebSocketReader(queue: alexapy.aiohttp.streams.DataQueue[alexapy.aiohttp.http_websocket.WSMessage], max_msg_size: int, compress: bool = True)

Inheritance

Inheritance diagram of WebSocketReader

parse_frame(buf: bytes) List[Tuple[bool, Optional[int], bytearray, Optional[bool]]]

Return the next frame from the socket.

class alexapy.aiohttp.http_websocket.WebSocketWriter(protocol: alexapy.aiohttp.base_protocol.BaseProtocol, transport: asyncio.transports.Transport, *, use_mask: bool = False, limit: int = 65536, random: typing.Any = <random.Random object>, compress: int = 0, notakeover: bool = False)

Inheritance

Inheritance diagram of WebSocketWriter

async close(code: int = 1000, message: bytes = b'') None

Close the websocket, sending the specified code and message.

async ping(message: bytes = b'') None

Send ping message.

async pong(message: bytes = b'') None

Send pong message.

async send(message: Union[str, bytes], binary: bool = False, compress: Optional[int] = None) None

Send a frame over the websocket with message as its payload.

class alexapy.aiohttp.http_websocket.WSMessage(type, data, extra)

Inheritance

Inheritance diagram of WSMessage

json(*, loads: typing.Callable[[typing.Any], typing.Any] = <function loads>) Any

Return parsed JSON data.

New in version 0.22.

class alexapy.aiohttp.http_websocket.WSMsgType(value)

An enumeration.

Inheritance

Inheritance diagram of WSMsgType

class alexapy.aiohttp.http_websocket.WSCloseCode(value)

An enumeration.

Inheritance

Inheritance diagram of WSCloseCode

Exceptions

exception alexapy.aiohttp.http_websocket.WebSocketError(code: int, message: str)

WebSocket protocol parser error.

Inheritance

Inheritance diagram of WebSocketError

Variables

alexapy.aiohttp.http_websocket.WS_CLOSED_MESSAGE
WSMessage(type=<WSMsgType.CLOSED: 257>, data=None, extra=None)
alexapy.aiohttp.http_websocket.WS_CLOSING_MESSAGE
WSMessage(type=<WSMsgType.CLOSING: 256>, data=None, extra=None)
alexapy.aiohttp.http_websocket.WS_KEY

bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object

Construct an immutable array of bytes from:
  • an iterable yielding integers in range(256)

  • a text string encoded using the specified encoding

  • any object implementing the buffer API.

  • an integer

b'258EAFA5-E914-47DA-95CA-C5AB0DC85B11'