Trait twist::extension::Header [] [src]

pub trait Header {
    fn from_header(&mut self, header: &str) -> Result<()>;
    fn into_header(&mut self) -> Result<Option<String>>;
}

Extensions are configured from the Sec-WebSocket-Extensions headers. Configure your extension based on that header.

Required Methods

Initialize your extension from the given Sec-WebSocket-Extensions header string. If your extension parameters exist, but are invalid, you should return an error here. If they don't exist you should mark yourself disabled (see enabled below), and return Ok. For a server-side extension, this will be called first, and should be used to generate the value that will be returned by into_header. For a client-side extension, this will be called after the server response is received, and should be use to re-configure your extension based on the value.

This should return your extensions Sec-WebSocket-Extensions header to be used in a request or response. For a server-side extension, this will be called after from_header has been called and the extension is configures. This result should represent your negotiation response. For a client-side extension, this will be called to ge the header for an extension negotiation request.

Implementors