[][src]Function xaynet::rest::serve

pub async fn serve<F, MH>(
    addr: impl Into<SocketAddr> + 'static,
    fetcher: F,
    pet_message_handler: MH
) where
    F: Fetcher + Sync + Send + 'static,
    MH: PetMessageHandler + Sync + Send + 'static, 

Starts a HTTP server at the given address, listening to GET requests for data and POST requests containing PET messages.

  • addr: address of the server.
  • fetcher: fetcher for responding to data requests.
  • pet_message_handler: handler for responding to PET messages.