[−][src]Struct web_push::WebPushMessageBuilder
The main class for creating a notification payload.
Methods
impl<'a> WebPushMessageBuilder<'a>
[src]
pub fn new(
subscription_info: &'a SubscriptionInfo
) -> Result<WebPushMessageBuilder<'a>, WebPushError>
[src]
subscription_info: &'a SubscriptionInfo
) -> Result<WebPushMessageBuilder<'a>, WebPushError>
Creates a builder for generating the web push payload.
All parameters are from the subscription info given by browser when subscribing to push notifications.
pub fn set_ttl(&mut self, ttl: u32)
[src]
How long the server should keep the message if it cannot be delivered currently. If not set, the message is deleted immediately on failed delivery.
pub fn set_gcm_key(&mut self, gcm_key: &'a str)
[src]
For Google's push service, one must provide an API key from Firebase console.
pub fn set_vapid_signature(&mut self, vapid_signature: VapidSignature)
[src]
Add a VAPID signature to the request. To be generated with the VapidSignatureBuilder.
pub fn set_payload(&mut self, encoding: ContentEncoding, payload: &'a [u8])
[src]
If set, the client will get content in the notification. Has a maximum size of 3800 characters.
pub fn build(self) -> Result<WebPushMessage, WebPushError>
[src]
Builds and if set, encrypts the payload. Any errors will be Undefined
, meaning
something was wrong in the given public key or authentication.
Auto Trait Implementations
impl<'a> RefUnwindSafe for WebPushMessageBuilder<'a>
impl<'a> Send for WebPushMessageBuilder<'a>
impl<'a> Sync for WebPushMessageBuilder<'a>
impl<'a> Unpin for WebPushMessageBuilder<'a>
impl<'a> UnwindSafe for WebPushMessageBuilder<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,