pub trait WebsocketExtensionExt: IsA<WebsocketExtension> + Sealed + 'static {
    // Provided methods
    fn request_params(&self) -> Option<GString> { ... }
    fn response_params(&self) -> Option<GString> { ... }
    fn process_incoming_message(
        &self,
        header: &mut u8,
        payload: Bytes
    ) -> Result<Bytes, Error> { ... }
    fn process_outgoing_message(
        &self,
        header: &mut u8,
        payload: Bytes
    ) -> Result<Bytes, Error> { ... }
}
Expand description

Trait containing all WebsocketExtension methods.

§Implementors

WebsocketExtensionDeflate, WebsocketExtension

Provided Methods§

source

fn request_params(&self) -> Option<GString>

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.

§Returns

a new allocated string with the parameters

source

fn response_params(&self) -> Option<GString>

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.

§Returns

a new allocated string with the parameters

source

fn process_incoming_message( &self, header: &mut u8, payload: Bytes ) -> Result<Bytes, Error>

Process a message after it’s received.

If the payload isn’t changed the given @payload is just returned, otherwise GLib::Bytes::unref() is called on the given @payload and a new glib::Bytes is returned with the new data.

Extensions using reserved bits of the header will reset them in @header.

the message header

§payload

the payload data

§Returns

the message payload data, or None in case of error

source

fn process_outgoing_message( &self, header: &mut u8, payload: Bytes ) -> Result<Bytes, Error>

Process a message before it’s sent.

If the payload isn’t changed the given @payload is just returned, otherwise Glib::Bytes::unref() is called on the given @payload and a new glib::Bytes is returned with the new data.

Extensions using reserved bits of the header will change them in @header.

§header

the message header

§payload

the payload data

§Returns

the message payload data, or None in case of error

Object Safety§

This trait is not object safe.

Implementors§