codekingpro/portable-devtools
115k
1"""WebSocket protocol versions 13 and 8."""
2
3from ._websocket.helpers import WS_KEY, ws_ext_gen, ws_ext_parse
4from ._websocket.models import (
5 WS_CLOSED_MESSAGE,
6 WS_CLOSING_MESSAGE,
7 WebSocketError,
8 WSCloseCode,
9 WSHandshakeError,
10 WSMessage,
11 WSMsgType,
12)
13from ._websocket.reader import WebSocketReader
14from ._websocket.writer import WebSocketWriter
15
16# Messages that the WebSocketResponse.receive needs to handle internally
17_INTERNAL_RECEIVE_TYPES = frozenset(
18 (WSMsgType.CLOSE, WSMsgType.CLOSING, WSMsgType.PING, WSMsgType.PONG)
19)
20
21
22__all__ = (
23 "WS_CLOSED_MESSAGE",
24 "WS_CLOSING_MESSAGE",
25 "WS_KEY",
26 "WebSocketReader",
27 "WebSocketWriter",
28 "WSMessage",
29 "WebSocketError",
30 "WSMsgType",
31 "WSCloseCode",
32 "ws_ext_gen",
33 "ws_ext_parse",
34 "WSHandshakeError",
35 "WSMessage",
36)
37 