rqpush 0.4.9

A library to assist with pushing notifications to RQueue.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use rqpush::Notification;

fn main() {
    // Create a notification by setting the app name, a notification title, and a short message.
    let mut notification = Notification::init("Example", "An example", "This is an example notification.");

    // Create a custom template, generating something like this: 
    //    "[Example] This is an example notification. (3)"
    notification.set_short_text_template("[{{app}}]: {{notification}} ({{integer}})".to_string());
    notification.add_value("integer".to_string(), 3.to_string());

    // Send the notification: in this example we send it to port 8000 on localhost, with a priority
    // of 55. We do not set a TTL nor a shared key.
    match notification.send("http://localhost:8000", 55, 0, None) {
        Ok(r) => println!("Success: {:?}", r),
        Err(e) => println!("Failure: {:?}", e),
    }
}