[−][src]Function xaynet_server::rest::serve
pub async fn serve<F>(
api_settings: ApiSettings,
fetcher: F,
pet_message_handler: PetMessageHandler
) -> Result<(), RestError> where
F: Fetcher + Sync + Send + 'static + Clone,
Starts a HTTP server at the given address, listening to GET requests for data and POST requests containing PET messages.
api_settings
: address of the server and optional certificate and key for TLS server authentication as well as trusted anchors for TLS client authentication.fetcher
: fetcher for responding to data requests.pet_message_handler
: handler for responding to PET messages.
Errors
Fails if the TLS settings are invalid.