Annotate

mod_push2/push2.md @ 6301:fa45ae704b79

mod_cloud_notify: Update Readme diff --git a/mod_cloud_notify/README.md b/mod_cloud_notify/README.md --- a/mod_cloud_notify/README.md +++ b/mod_cloud_notify/README.md @@ -1,109 +1,106 @@ ---- -labels: -- 'Stage-Beta' -summary: 'XEP-0357: Cloud push notifications' ---- +# Introduction -Introduction -============ +This module enables support for sending "push notifications" to clients +that need it, typically those running on certain mobile devices. -This module enables support for sending "push notifications" to clients that -need it, typically those running on certain mobile devices. +As well as this module, your client must support push notifications (the +apps that need it generally do, of course) and the app developer's push +gateway must be reachable from your Prosody server (this happens over a +normal XMPP server-to-server 's2s' connection). -As well as this module, your client must support push notifications (the apps -that need it generally do, of course) and the app developer's push gateway -must be reachable from your Prosody server (this happens over a normal XMPP -server-to-server 's2s' connection). - -Details -======= +# Details Some platforms, notably Apple's iOS and many versions of Android, impose -limits that prevent applications from running or accessing the network in the -background. This makes it difficult or impossible for an XMPP application to -remain reliably connected to a server to receive messages. - -In order for messaging and other apps to receive notifications, the OS vendors -run proprietary servers that their OS maintains a permanent connection to in -the background. Then they provide APIs to application developers that allow -sending notifications to specific devices via those servers. +limits that prevent applications from running or accessing the network +in the background. This makes it difficult or impossible for an XMPP +application to remain reliably connected to a server to receive +messages. -When you connect to your server with an app that requires push notifications, -it will use this module to set up a "push registration". When you receive -a message but your device is not connected to the server, this module will -generate a notification and send it to the push gateway operated by your -application's developers). Their gateway will then connect to your device's -OS vendor and ask them to forward the notification to your device. When your -device receives the notification, it will display it or wake up the app so it -can connect to XMPP and receive any pending messages. +In order for messaging and other apps to receive notifications, the OS +vendors run proprietary servers that their OS maintains a permanent +connection to in the background. Then they provide APIs to application +developers that allow sending notifications to specific devices via +those servers. -This protocol is described for developers in [XEP-0357: Push Notifications]. +When you connect to your server with an app that requires push +notifications, it will use this module to set up a "push registration". +When you receive a message but your device is not connected to the +server, this module will generate a notification and send it to the push +gateway operated by your application's developers). Their gateway will +then connect to your device's OS vendor and ask them to forward the +notification to your device. When your device receives the notification, +it will display it or wake up the app so it can connect to XMPP and +receive any pending messages. -For this module to work reliably, you must have [mod_smacks], [mod_mam] and -[mod_carbons] also enabled on your server. +This protocol is described for developers in \[XEP-0357: Push +Notifications\]. + +For this module to work reliably, you must have \[mod_smacks\], +\[mod_mam\] and \[mod_carbons\] also enabled on your server. -Some clients, notably Siskin and Snikket iOS need some additional extensions -that are not currently defined in a standard XEP. To support these clients, -see [mod_cloud_notify_extensions]. +Some clients, notably Siskin and Snikket iOS need some additional +extensions that are not currently defined in a standard XEP. To support +these clients, see \[mod_cloud_notify_extensions\]. -Configuration -============= +# Configuration - Option Default Description - ------------------------------------ ----------------- ------------------------------------------------------------------------------------------------------------------- - `push_notification_important_body` `New Message!` The body text to use when the stanza is important (see above), no message body is sent if this is empty - `push_max_errors` `16` How much persistent push errors are tolerated before notifications for the identifier in question are disabled - `push_max_devices` `5` The number of allowed devices per user (the oldest devices are automatically removed if this threshold is reached) - `push_max_hibernation_timeout` `259200` (72h) Number of seconds to extend the smacks timeout if no push was triggered yet (default: 72 hours) - `push_notification_with_body` (\*) `false` Whether or not to send the real message body to remote pubsub node. Without end-to-end encryption, enabling this may expose your message contents to your client developers and OS vendor. Not recommended. - `push_notification_with_sender` (\*) `false` Whether or not to send the real message sender to remote pubsub node. Enabling this may expose your contacts to your client developers and OS vendor. Not recommended. + Option Default Description + -------------------------------------- ---------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + `push_notification_important_body` `New Message!` The body text to use when the stanza is important (see above), no message body is sent if this is empty + `push_max_errors` `16` How much persistent push errors are tolerated before notifications for the identifier in question are disabled + `push_max_devices` `5` The number of allowed devices per user (the oldest devices are automatically removed if this threshold is reached) + `push_max_hibernation_timeout` `259200` (72h) Number of seconds to extend the smacks timeout if no push was triggered yet (default: 72 hours) + `push_notification_with_body` (\*) `false` Whether or not to send the real message body to remote pubsub node. Without end-to-end encryption, enabling this may expose your message contents to your client developers and OS vendor. Not recommended. + `push_notification_with_sender` (\*) `false` Whether or not to send the real message sender to remote pubsub node. Enabling this may expose your contacts to your client developers and OS vendor. Not recommended. -(\*) There are privacy implications for enabling these options. +(\*) There are privacy implications for enabling these options.[^1] -Internal design notes -===================== +# Internal design notes -App servers are notified about offline messages, messages stored by [mod_mam] -or messages waiting in the smacks queue. -The business rules outlined [here](//mail.jabber.org/pipermail/standards/2016-February/030925.html) are all honored[^2]. +App servers are notified about offline messages, messages stored by +\[mod_mam\] or messages waiting in the smacks queue. The business rules +outlined +[here](//mail.jabber.org/pipermail/standards/2016-February/030925.html) +are all honored[^2]. -To cooperate with [mod_smacks] this module consumes some events: -`smacks-ack-delayed`, `smacks-hibernation-start` and `smacks-hibernation-end`. -These events allow this module to send out notifications for messages received -while the session is hibernated by [mod_smacks] or even when smacks -acknowledgements for messages are delayed by a certain amount of seconds -configurable with the [mod_smacks] setting `smacks_max_ack_delay`. +To cooperate with \[mod_smacks\] this module consumes some events: +`smacks-ack-delayed`, `smacks-hibernation-start` and +`smacks-hibernation-end`. These events allow this module to send out +notifications for messages received while the session is hibernated by +\[mod_smacks\] or even when smacks acknowledgements for messages are +delayed by a certain amount of seconds configurable with the +\[mod_smacks\] setting `smacks_max_ack_delay`. -The `smacks_max_ack_delay` setting allows to send out notifications to clients -which aren't already in smacks hibernation state (because the read timeout or -connection close didn't already happen) but also aren't responding to acknowledgement -request in a timely manner. This setting thus allows conversations to be smoother -under such circumstances. +The `smacks_max_ack_delay` setting allows to send out notifications to +clients which aren't already in smacks hibernation state (because the +read timeout or connection close didn't already happen) but also aren't +responding to acknowledgement request in a timely manner. This setting +thus allows conversations to be smoother under such circumstances. -The new event `cloud-notify-ping` can be used by any module to send out a cloud -notification to either all registered endpoints for the given user or only the endpoints -given in the event data. +The new event `cloud-notify-ping` can be used by any module to send out +a cloud notification to either all registered endpoints for the given +user or only the endpoints given in the event data. -The config setting `push_notification_important_body` can be used to specify an alternative -body text to send to the remote pubsub node if the stanza is encrypted or has a body. -This way the real contents of the message aren't revealed to the push appserver but it -can still see that the push is important. -This is used by Chatsecure on iOS to send out high priority pushes in those cases for example. +The config setting `push_notification_important_body` can be used to +specify an alternative body text to send to the remote pubsub node if +the stanza is encrypted or has a body. This way the real contents of the +message aren't revealed to the push appserver but it can still see that +the push is important. This is used by Chatsecure on iOS to send out +high priority pushes in those cases for example. -Compatibility -============= - -**Note:** This module should be used with Lua 5.2 and higher. Using it with -Lua 5.1 may cause push notifications to not be sent to some clients. +# Compatibility ------- ----------------------------------------------------------------------------- - trunk Works - 0.12 Works - 0.11 Works - 0.10 Works - 0.9 Support dropped, use last supported version [675726ab06d3](//hg.prosody.im/prosody-modules/raw-file/675726ab06d3/mod_cloud_notify/mod_cloud_notify.lua) ------- ----------------------------------------------------------------------------- +**Note:** This module should be used with Lua 5.2 and higher. Using it +with Lua 5.1 may cause push notifications to not be sent to some +clients. + ------- ----------------------------------------------------------------- + trunk Works as of 25-06-13 + 13 Works + 0.12 Works + ------- ----------------------------------------------------------------- -[^1]: The service which is expected to forward notifications to something like Google Cloud Messaging or Apple Notification Service -[^2]: [business_rules.markdown](//hg.prosody.im/prosody-modules/file/tip/mod_cloud_notify/business_rules.markdown) +[^1]: The service which is expected to forward notifications to + something like Google Cloud Messaging or Apple Notification Service + +[^2]: [business_rules.md](//hg.prosody.im/prosody-modules/file/tip/mod_cloud_notify/business_rules.md)
author Menel <menel@snikket.de>
date Fri, 13 Jun 2025 10:36:52 +0200
parent 6233:1c16bb49f6f6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5682
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
1 # Push 2.0
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
2
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
3 Adapted from notes made at [XMPP Summit 25](https://pad.nixnet.services/oy6MKVbESSycLeMJIOh6zw).
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
4
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
5 Requirements:
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
6
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
7 - Support for SASL2 inlining
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
8 - Extensible stanza matching rules and notification payload rules
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
9 - Simpler syntax and concept model than original specification
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
10
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
11 ## Client registers to receive push notifications
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
12
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
13 ```xml
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
14 <enable xmlns='urn:xmpp:push2:0'>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
15 <service>pusher@push.example.com</service>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
16 <client>https://push.example.com/adlfkjadafdasf</client>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
17 <match profile="urn:xmpp:push2:match:archived-with-body">
6216
2f2539ce8f3b mod_push2: implement grace period
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6215
diff changeset
18 <grace>144</grace>
6233
1c16bb49f6f6 mod_push2: rename chat to filter
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6216
diff changeset
19 <filter jid="somemuc@conference.example.com">
6215
e53f0967520c mod_push: Allow filtering pushes for particular chats
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6190
diff changeset
20 <mention/>
6233
1c16bb49f6f6 mod_push2: rename chat to filter
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6216
diff changeset
21 </filter>
5682
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
22 <send xmlns="urn:xmpp:push2:send:notify-only:0"/>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
23 </match>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
24 </enable>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
25 ```
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
26
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
27 The `<service/>` element contains a JID which push notifications for this client will be sent to. It may be a host, bare or full JID.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
28
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
29 The `<client/>` element contains an opaque string that will be included in all communication with the push service. It may be used to convey client identifiers used by the push notification service to route notifications.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
30
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
31 The `<match/>` and `<send/>` elements define what profiles to use for matching stanzas and sending notifications. These are described later in this document.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
32
6233
1c16bb49f6f6 mod_push2: rename chat to filter
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6216
diff changeset
33 The optional `<filter/>` child of `<match/>` allows extra filtering of pushes for only specific chats. No specified filters means muted, do not push. `<mention/>` means push on mentions, `<reply/>` means push on replies.
6215
e53f0967520c mod_push: Allow filtering pushes for particular chats
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6190
diff changeset
34
6216
2f2539ce8f3b mod_push2: implement grace period
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6215
diff changeset
35 The optional `<grace/>` child of `<match/>` allows specifying a "grace period" in seconds where activity on another session by the same user (such as sending a message) will temporarily pause sending push notifications.
2f2539ce8f3b mod_push2: implement grace period
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6215
diff changeset
36
5682
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
37 ## Match and send profiles
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
38
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
39 Different clients and push services have different requirements for push notifications, often due to the differing capabilities of target platforms.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
40
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
41 A "profile" in the context of this specification is a set of rules for matching the kinds of stanzas that should be pushed, and how to transform them before sending the notification to the push service.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
42
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
43 ### Match profiles
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
44
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
45 Match profiles define which incoming stanzas will trigger a push notification. More than one match may be specified.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
46
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
47 Some match profiles are defined in this XEP. Other XEPs may define additional profiles with the reserved `urn:xmpp:push2:match:` prefix, following the registrar considerations explained later in this document. Custom profiles not defined in a XEP should use their own appropriate URI.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
48
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
49 #### `urn:xmpp:push2:match:all`
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
50
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
51 Using this profile, all stanzas will trigger a push notification to be sent to the push service when the client is unavailable.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
52
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
53 #### `urn:xmpp:push2:match:important`
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
54
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
55 Stanzas that are considered to be "important" are pushed. At the time of writing, there is no standard definition of "important", however most servers already contain such logic for traffic optimization when combined with [XEP-0352: Client State Indication](https://xmpp.org/extensions/xep-0352.html).
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
56
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
57 #### `urn:xmpp:push2:match:archived`
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
58
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
59 Push notifications will be sent for any stanza that is stored in the user's archive. This is a good indication that the stanza is important, and is desired on all of a user's devices.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
60
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
61 #### `urn:xmpp:push2:match:archived-with-body`
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
62
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
63 Matches only archived messages that contain a body. This can be used to exclude certain message types, such as typing notifications, receipts and error replies.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
64
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
65 ### Send profiles
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
66
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
67 When a server has determined that a stanza should trigger a push notification (according to the client's selected 'match' profile), it proceeds to create a notification stanza following the send profiles specified in the match profiles which match this stanza.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
68
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
69 After constructing the notification stanza, it will then be sent to the push service JID selected by the client.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
70
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
71 Some send profiles are defined in this XEP. Other XEPs may define additional profiles with the `urn:xmpp:push2:send:` prefix, following the registrar considerations explained later in this document. Custom profiles not defined in a XEP should use their own appropriate URI.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
72
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
73 #### `urn:xmpp:push2:send:notify-only:0`
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
74
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
75 Send an empty notification to the push service. Such notifications are useful if a push notification can trigger the client to "wake up" and connect to the server to receive the message over XMPP.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
76
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
77 Example:
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
78
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
79 ```xml
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
80 <message to="pusher@push.example.net">
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
81 <notification xmlns="urn:xmpp:push2:0">
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
82 <client>https://push.example.com/adlfkjadafdasf</client>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
83 <priority>normal</priority>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
84 </notification>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
85 </message>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
86 ```
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
87
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
88 #### `urn:xmpp:push2:send:sce+rfc8291+rfc8292:0`
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
89
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
90 Delivers content encrypted according to RFC8291 and with a JWT auth following RFC8292
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
91
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
92 ```xml
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
93 <send xmlns="urn:xmpp:push2:send:sce+rfc8291+rfc8292:0">
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
94 <ua-public>Base64 encoded P-256 ECDH public key (raw, uncompressed)</ua-public>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
95 <auth-secret>Base64 encoded randomly generated 16 octets</auth-secret>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
96 <jwt-alg>ES256</jwt-alg>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
97 <jwt-key>PKCS#8 PEM encoded ECDSA keypair, without the header or footer lines</jwt-key>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
98 <jwt-claim name="aud">https://push.example.com</jwt-claim>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
99 </send>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
100 ```
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
101
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
102 The full stanza is wrapped in XEP-0297 forwarded and then that is wrapped in XEP-0420 envelope/content with optional rpad. The raw bytes of the resulting XML are encrypted according to RFC8291 using the provided `ua-public` and `auth-secret`.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
103
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
104 If `jwt-alg` is specified, then a JWT is computed over any provided claims plus a suitable `exp` and `sub` claim and signed using the provided key.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
105
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
106 Then a notification is sent:
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
107
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
108 ```xml
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
109 <message to="pusher@push.example.net">
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
110 <notification xmlns="urn:xmpp:push2:0">
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
111 <client>https://push.example.com/adlfkjadafdasf</client>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
112 <priority>normal</priority>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
113 <encrypted xmlns="urn:xmpp:sce:rfc8291:0">
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
114 <payload>Base64 encoded ciphertext</payload>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
115 </encrypted>
5686
a1d22d6efb3d mod_push2: Need to include the public key with the JWT
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 5682
diff changeset
116 <jwt key="base64 encoded raw public key">the signed JWT, if present</jwt>
5682
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
117 </notification>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
118 </message>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
119 ```
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
120
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
121 NOTE: if the stanza exceeds the maximum size of 4096 bytes (and some implementations may wish to restrict this even more) the stanza may have some elements removed, body truncated, etc before it is delivered. Servers SHOULD ensure that at least the MAM id (if there is one) is still present after any minimization.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
122
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
123 ## Discovering support
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
124
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
125 A server that supports this protocol MUST advertise the `urn:xmpp:push2:0` feature in an account's service discovery information, along with the supported match and send profiles.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
126
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
127 ```xml
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
128 <iq from='juliet@capulet.lit'
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
129 to='juliet@capulet.lit/balcony'
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
130 id='disco1'
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
131 type='result'>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
132 <query xmlns='http://jabber.org/protocol/disco#info'>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
133 <identity category='account' type='registered'/>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
134 <feature var='urn:xmpp:push2:0'/>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
135 <feature var='urn:xmpp:push2:send:'/>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
136 </query>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
137 </iq>
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
138 ```
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
139
6190
aa240145aa22 mod_push2: support for disabling push notifications
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6003
diff changeset
140 ## Client disables future pushes
aa240145aa22 mod_push2: support for disabling push notifications
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6003
diff changeset
141
aa240145aa22 mod_push2: support for disabling push notifications
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6003
diff changeset
142 ```xml
aa240145aa22 mod_push2: support for disabling push notifications
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6003
diff changeset
143 <disable xmlns='urn:xmpp:push2:0' />
aa240145aa22 mod_push2: support for disabling push notifications
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6003
diff changeset
144 ```
aa240145aa22 mod_push2: support for disabling push notifications
Stephen Paul Weber <singpolyma@singpolyma.net>
parents: 6003
diff changeset
145
5682
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
146 ## Push service interactions
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
147
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
148 ### Transient delivery errors
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
149
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
150 The user's server might receive delivery errors while sending notifications to the user's push service. The error 'type' attribute SHOULD be honoured - errors of type 'wait' SHOULD be retried in an appropriate manner (e.g. using exponential back-off algorithm, up to a limit), discarding the notification after an appropriate length of time or number of attempts.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
151
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
152 Other error types MUST NOT be automatically retried.
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
153
4d1a3de56c3d Initial work on Push 2.0
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff changeset
154 A user's server MAY automatically disable a push configuration for a service that has consistently failed to relay notifications for an extended period of time. This period is a matter of deployment configuration, but a default no less than 72 hours is recommended.