quart.wrappers.websocket module
- class quart.wrappers.websocket.Websocket(path, query_string, scheme, headers, root_path, http_version, subprotocols, receive, send, accept, close, scope)
Bases:
BaseRequestWebsocket- Parameters:
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) –
- property requested_subprotocols: list[str]
- async receive()
- Return type:
AnyStr
- async send(data)
- Parameters:
data (AnyStr) –
- Return type:
None
- async receive_json()
- Return type:
Any
- async send_json(*args, **kwargs)
- Parameters:
args (Any) –
kwargs (Any) –
- Return type:
None
- async accept(headers=None, subprotocol=None)
Manually chose to accept the websocket connection.
- Parameters:
headers (dict | Headers | None) – Additional headers to send with the acceptance response.
subprotocol (str | None) – The chosen subprotocol, optional.
- Return type:
None
- async close(code, reason='')
- Parameters:
code (int) –
reason (str) –
- Return type:
None