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: dict | Headers | None = None, subprotocol: str | None = None) None#

Manually chose to accept the websocket connection.

Parameters:
  • 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(*args: Any, **kwargs: Any) None#