README.md in pushpad-0.3.1 vs README.md in pushpad-0.4.0

- old
+ new

@@ -1,9 +1,9 @@ -# Pushpad - Web Push Notifications +# Pushpad - Web Push Notifications Service + +[Pushpad](https://pushpad.xyz) is a service for sending push notifications from your web app. It supports the **Push API** (Chrome and Firefox) and **APNs** (Safari). -Add native push notifications to your web app using [Pushpad](https://pushpad.xyz). - Features: - notifications are delivered even when the user is not on your website - users don't need to install any app or plugin - you can target specific users or send bulk notifications @@ -58,29 +58,30 @@ Pushpad.signature_for current_user.id ``` ### Pushpad Express -Add a link to let users subscribe to push notifications: +If you want to use Pushpad Express, add a link to your website to let users subscribe to push notifications: ```erb -<a href="<%= Pushpad.path %>">Subscribe anonymous to push notifications</a> +<a href="<%= Pushpad.path %>">Push notifications</a> -<a href="<%= Pushpad.path_for current_user # or current_user_id %>">Subscribe current user to push notifications</a> +<!-- If the user is logged in on your website you should track its user id to target him in the future --> +<a href="<%= Pushpad.path_for current_user # or current_user_id %>">Push notifications</a> ``` -`current_user` is the user currently logged in on your website. +When a user clicks the link is sent to Pushpad, asked to receive push notifications and redirected back to your website. -When a user clicks the link is sent to Pushpad, automatically asked to receive push notifications and redirected back to your website. - ## Sending push notifications ```ruby notification = Pushpad::Notification.new({ body: "Hello world!", # max 90 characters title: "Website Name", # optional, defaults to your project name, max 30 characters - target_url: "http://example.com" # optional, defaults to your project website + target_url: "http://example.com", # optional, defaults to your project website + icon_url: "http://example.com/assets/icon.png", # optional, defaults to the project icon + ttl: 604800 # optional, drop the notification after this number of seconds if a device is offline }) # deliver to a user notification.deliver_to user # or user_id @@ -100,9 +101,10 @@ If no user with that id has subscribed to push notifications, that id is simply ignored. The methods above return an hash: +- `"id"` is the id of the notification on Pushpad - `"scheduled"` is the number of devices to which the notification will be sent - `"uids"` (`deliver_to` only) are the user IDs that will be actually reached by the notification (unless they have unsubscribed since the last notification) ## License