RQPush
A library to assist with pushing notifications to RQueue.
RQPush Overview
RQPush is only useful as a library for pushing notifications into RQueue. For this purpose, it provides the following functionality:
- Builds notifications with support for Handlebar templating
- Calculates a sha256 hash of each notification, optionally salted with a shared secret
- (@TODO) Routes notifications to the appropriate queue via SRV records
Notifications Overview
Notifications require the following three fields:
app: application nametitle: the title of the notification, for example used as an email subjectshort_text: the body of the notification
The following fields can optionally be defined as well:
url: ie, the URL of the project generating the notification, or a URL to view more informationtagline: a description of the project generating the notificationcategory: allows arbitrary categorization of notifications, primarily used for filtering and routinglang: two letter language code, defaults to "en"short_text_template: allows handlebar variable replacement, for example{{foo}}short_html: html version of short_textshort_html_template: allows handlebar variable replacement and wraps in appropriate HTML tagslong_text: optional extended version ofshort_textlong_html_template: allows handlebar variable replacement and wraps in appropriate HTML tagsvalues: key-value pairs for handlebars-style templating
Working With Notifications
Notifications are created as follows:
use Notification;
let mut notification: Notification = init;
This is enough to generate a basic notification, however additional customization is possible. For example, to set a project URL on a notification that was created per the earlier example:
notification.set_title;
And finally, a notification can be sent as follows:
notification.send;
In this example, we send the notification to port 8000 on localhost, with a priority of 42. We don't set a TTL so the notification or a shared secret.
Netgrasp Example
The following example shows a real-world example, sending a notification with Netgrasp.
use Notification;
let mut notification: Notification = init;
notification.set_category;
@TODO: Finish: