quart.wrappers.websocket 模块#
- class quart.wrappers.websocket.Websocket(path: str, query_string: bytes, scheme: str, headers: Headers, root_path: str, http_version: str, subprotocols: list[str], receive: Callable, send: Callable, accept: Callable, close: Callable, scope: WebsocketScope)#
-
- async accept(headers: dict | Headers | None = None, subprotocol: str | None = None) None #
手动选择接受 websocket 连接。
- 参数:
headers – 接受响应时发送的附加头信息。
subprotocol – 选择的子协议,可选。
- async close(code: int, reason: str = '') None #
- async receive() AnyStr #
- async receive_json() Any #
- property requested_subprotocols: list[str]#
- async send(data: AnyStr) None #
- async send_json(*args: Any, **kwargs: Any) None #