comparison mod_cloud_notify/README.md @ 5975:fe081789f7b5

All community modules: Unify file extention of Markdown files to .md
author Menel <menel@snikket.de>
date Tue, 22 Oct 2024 10:26:01 +0200
parents mod_cloud_notify/README.markdown@1d9dbe84b6e8
children fa45ae704b79
comparison
equal deleted inserted replaced
5974:5a65a632d5b9 5975:fe081789f7b5
1 ---
2 labels:
3 - 'Stage-Beta'
4 summary: 'XEP-0357: Cloud push notifications'
5 ---
6
7 Introduction
8 ============
9
10 This module enables support for sending "push notifications" to clients that
11 need it, typically those running on certain mobile devices.
12
13 As well as this module, your client must support push notifications (the apps
14 that need it generally do, of course) and the app developer's push gateway
15 must be reachable from your Prosody server (this happens over a normal XMPP
16 server-to-server 's2s' connection).
17
18 Details
19 =======
20
21 Some platforms, notably Apple's iOS and many versions of Android, impose
22 limits that prevent applications from running or accessing the network in the
23 background. This makes it difficult or impossible for an XMPP application to
24 remain reliably connected to a server to receive messages.
25
26 In order for messaging and other apps to receive notifications, the OS vendors
27 run proprietary servers that their OS maintains a permanent connection to in
28 the background. Then they provide APIs to application developers that allow
29 sending notifications to specific devices via those servers.
30
31 When you connect to your server with an app that requires push notifications,
32 it will use this module to set up a "push registration". When you receive
33 a message but your device is not connected to the server, this module will
34 generate a notification and send it to the push gateway operated by your
35 application's developers). Their gateway will then connect to your device's
36 OS vendor and ask them to forward the notification to your device. When your
37 device receives the notification, it will display it or wake up the app so it
38 can connect to XMPP and receive any pending messages.
39
40 This protocol is described for developers in [XEP-0357: Push Notifications].
41
42 For this module to work reliably, you must have [mod_smacks], [mod_mam] and
43 [mod_carbons] also enabled on your server.
44
45 Some clients, notably Siskin and Snikket iOS need some additional extensions
46 that are not currently defined in a standard XEP. To support these clients,
47 see [mod_cloud_notify_extensions].
48
49 Configuration
50 =============
51
52 Option Default Description
53 ------------------------------------ ----------------- -------------------------------------------------------------------------------------------------------------------
54 `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
55 `push_max_errors` `16` How much persistent push errors are tolerated before notifications for the identifier in question are disabled
56 `push_max_devices` `5` The number of allowed devices per user (the oldest devices are automatically removed if this threshold is reached)
57 `push_max_hibernation_timeout` `259200` (72h) Number of seconds to extend the smacks timeout if no push was triggered yet (default: 72 hours)
58 `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.
59 `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.
60
61 (\*) There are privacy implications for enabling these options.
62
63 Internal design notes
64 =====================
65
66 App servers are notified about offline messages, messages stored by [mod_mam]
67 or messages waiting in the smacks queue.
68 The business rules outlined [here](//mail.jabber.org/pipermail/standards/2016-February/030925.html) are all honored[^2].
69
70 To cooperate with [mod_smacks] this module consumes some events:
71 `smacks-ack-delayed`, `smacks-hibernation-start` and `smacks-hibernation-end`.
72 These events allow this module to send out notifications for messages received
73 while the session is hibernated by [mod_smacks] or even when smacks
74 acknowledgements for messages are delayed by a certain amount of seconds
75 configurable with the [mod_smacks] setting `smacks_max_ack_delay`.
76
77 The `smacks_max_ack_delay` setting allows to send out notifications to clients
78 which aren't already in smacks hibernation state (because the read timeout or
79 connection close didn't already happen) but also aren't responding to acknowledgement
80 request in a timely manner. This setting thus allows conversations to be smoother
81 under such circumstances.
82
83 The new event `cloud-notify-ping` can be used by any module to send out a cloud
84 notification to either all registered endpoints for the given user or only the endpoints
85 given in the event data.
86
87 The config setting `push_notification_important_body` can be used to specify an alternative
88 body text to send to the remote pubsub node if the stanza is encrypted or has a body.
89 This way the real contents of the message aren't revealed to the push appserver but it
90 can still see that the push is important.
91 This is used by Chatsecure on iOS to send out high priority pushes in those cases for example.
92
93 Compatibility
94 =============
95
96 **Note:** This module should be used with Lua 5.2 and higher. Using it with
97 Lua 5.1 may cause push notifications to not be sent to some clients.
98
99 ------ -----------------------------------------------------------------------------
100 trunk Works
101 0.12 Works
102 0.11 Works
103 0.10 Works
104 0.9 Support dropped, use last supported version [675726ab06d3](//hg.prosody.im/prosody-modules/raw-file/675726ab06d3/mod_cloud_notify/mod_cloud_notify.lua)
105 ------ -----------------------------------------------------------------------------
106
107
108 [^1]: The service which is expected to forward notifications to something like Google Cloud Messaging or Apple Notification Service
109 [^2]: [business_rules.markdown](//hg.prosody.im/prosody-modules/file/tip/mod_cloud_notify/business_rules.markdown)