Struct web_push::WebPushMessageBuilder
[−]
[src]
pub struct WebPushMessageBuilder<'a> { /* fields omitted */ }
Methods
impl<'a> WebPushMessageBuilder<'a>
[src]
fn new(
endpoint: &'a str,
auth: &'a [u8],
p256dh: &'a [u8]
) -> Result<WebPushMessageBuilder<'a>, WebPushError>
[src]
endpoint: &'a str,
auth: &'a [u8],
p256dh: &'a [u8]
) -> 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.
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.
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.
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.
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.