Trait tk_http::server::buffered::Service [] [src]

pub trait Service<S: Io> {
    type Future: Future<Item=EncoderDone<S>, Error=Error>;
    type WebsocketFuture: Future<Item=(), Error=()> + 'static;
    fn call(&mut self, request: Request, encoder: Encoder<S>) -> Self::Future;
    fn start_websocket(&mut self,
                       output: WriteFramed<S, WebsocketCodec>,
                       input: ReadFramed<S, WebsocketCodec>)
                       -> Self::WebsocketFuture; }

An instance of a NewService for a single request, usually just a function

Associated Types

A future returned by call()

A future returned by start_websocket, it's spawned on the main loop hence needed to be static.

Required Methods

A method which is called when request arrives, including the websocket negotiation request.

See examples for a way to negotiate both websockets and services

A method which is called when websocket connection established

Implementors