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 crate::{WebPushError, WebPushMessage};
7use async_trait::async_trait;
8
9pub mod request_builder;
10
11#[cfg(feature = "hyper-client")]
12pub mod hyper_client;
13
14#[cfg(feature = "isahc-client")]
15pub mod isahc_client;
16
17const MAX_RESPONSE_SIZE: usize = 64 * 1024;
18
19/// An async client for sending the notification payload.
20/// Other features, such as thread safety, may vary by implementation.
21#[async_trait]
22pub trait WebPushClient {
23    /// Sends a notification. Never times out.
24    async fn send(&self, message: WebPushMessage) -> Result<(), WebPushError>;
25}