Trait tungstenite::handshake::server::Callback [−][src]
The callback trait.
The callback is called when the server receives an incoming WebSocket handshake request from the client. Specifying a callback allows you to analyze incoming headers and add additional headers to the response that server sends to the client and/or reject the connection based on the incoming headers.
Required methods
fn on_request(
self,
request: &Request,
response: Response
) -> StdResult<Response, ErrorResponse>
[src]
self,
request: &Request,
response: Response
) -> StdResult<Response, ErrorResponse>
Called whenever the server read the request from the client and is ready to reply to it. May return additional reply headers. Returning an error resulting in rejecting the incoming connection.
Implementors
impl Callback for NoCallback
[src]
fn on_request(
self,
_request: &Request,
response: Response
) -> StdResult<Response, ErrorResponse>
[src]
self,
_request: &Request,
response: Response
) -> StdResult<Response, ErrorResponse>
impl<F> Callback for F where
F: FnOnce(&Request, Response) -> StdResult<Response, ErrorResponse>,
[src]
F: FnOnce(&Request, Response) -> StdResult<Response, ErrorResponse>,
fn on_request(
self,
request: &Request,
response: Response
) -> StdResult<Response, ErrorResponse>
[src]
self,
request: &Request,
response: Response
) -> StdResult<Response, ErrorResponse>