WebsocketExtension#
Superclasses: Object
Subclasses: WebsocketExtensionDeflate
A WebSocket extension
WebsocketExtension
is the base class for WebSocket extension objects.
Methods#
- class WebsocketExtension
- configure(connection_type: WebsocketConnectionType, params: dict[Any, Any] | None = None) bool #
Configures
extension
with the givenparams
.
- do_configure(self, connection_type: WebsocketConnectionType, params: dict[Any, Any] | None = None) bool #
- Parameters:
connection_type
params
- do_process_incoming_message(self, header: int, payload: Bytes) Tuple[Bytes, int] #
- Parameters:
header
payload
- do_process_outgoing_message(self, header: int, payload: Bytes) Tuple[Bytes, int] #
- Parameters:
header
payload
- get_request_params() str | None #
Get the parameters strings to be included in the request header.
If the extension doesn’t include any parameter in the request, this function returns
None
.
- get_response_params() str | None #
Get the parameters strings to be included in the response header.
If the extension doesn’t include any parameter in the response, this function returns
None
.
- process_incoming_message(header: int, payload: Bytes) Tuple[Bytes, int] #
Process a message after it’s received.
If the payload isn’t changed the given
payload
is just returned, otherwiseunref
is called on the givenpayload
and a newBytes
is returned with the new data.Extensions using reserved bits of the header will reset them in
header
.- Parameters:
header – the message header
payload – the payload data
- process_outgoing_message(header: int, payload: Bytes) Tuple[Bytes, int] #
Process a message before it’s sent.
If the payload isn’t changed the given
payload
is just returned, otherwiseunref
is called on the givenpayload
and a newBytes
is returned with the new data.Extensions using reserved bits of the header will change them in
header
.- Parameters:
header – the message header
payload – the payload data
Virtual Methods#
- class WebsocketExtension
- do_configure(connection_type: WebsocketConnectionType, params: dict[Any, Any] | None = None) bool #
Configures
extension
with the givenparams
.
- do_get_request_params() str | None #
Get the parameters strings to be included in the request header.
If the extension doesn’t include any parameter in the request, this function returns
None
.
- do_get_response_params() str | None #
Get the parameters strings to be included in the response header.
If the extension doesn’t include any parameter in the response, this function returns
None
.
- do_process_incoming_message(header: int, payload: Bytes) Tuple[Bytes, int] #
Process a message after it’s received.
If the payload isn’t changed the given
payload
is just returned, otherwiseunref
is called on the givenpayload
and a newBytes
is returned with the new data.Extensions using reserved bits of the header will reset them in
header
.- Parameters:
header – the message header
payload – the payload data
- do_process_outgoing_message(header: int, payload: Bytes) Tuple[Bytes, int] #
Process a message before it’s sent.
If the payload isn’t changed the given
payload
is just returned, otherwiseunref
is called on the givenpayload
and a newBytes
is returned with the new data.Extensions using reserved bits of the header will change them in
header
.- Parameters:
header – the message header
payload – the payload data
Fields#
- class WebsocketExtension
- parent_instance#