web_push/clients/mod.rs
1//! Contains implementations of web push clients.
2//!
3//! [`request_builder`] contains the functions used to send and consume push http messages.
4//! This module should be consumed by each client, by using [`http`]'s flexible api.
5
6use async_trait::async_trait;
7
8use crate::{WebPushError, WebPushMessage};
9
10pub mod request_builder;
11
12#[cfg(feature = "hyper-client")]
13pub mod hyper_client;
14
15#[cfg(feature = "isahc-client")]
16pub mod isahc_client;
17
18const MAX_RESPONSE_SIZE: usize = 64 * 1024;
19
20/// An async client for sending the notification payload.
21/// Other features, such as thread safety, may vary by implementation.
22#[async_trait]
23pub trait WebPushClient {
24 /// Sends a notification. Never times out.
25 async fn send(&self, message: WebPushMessage) -> Result<(), WebPushError>;
26}