quart.wrappers.websocket module#

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)#

Bases: BaseRequestWebsocket

async accept(headers: Optional[Union[dict, Headers]] = None, subprotocol: Optional[str] = None) None#

Manually chose to accept the websocket connection.

  • headers – Additional headers to send with the acceptance response.

  • subprotocol – The chosen subprotocol, optional.

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(data: Any) None#