docs: Add guide for push notifications #2244
No reviewers
Labels
No labels
Abandoned
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
bob the builder
No milestone
No assignees
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
continuwuation/continuwuity!2244
Loading…
Reference in a new issue
No description provided.
Delete branch "stratself/continuwuity:stratself/docs-push-notifications"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR adds a page for push notifications under /guides. The main thing it covers are how push works in Matrix, UnifiedPush usage and selfhosting, and some troubleshooting of common push issues.
I took the liberty to include various aspects of push not pertaining to the server itself, because it was commonly asked in our chatrooms and are quite important for all matrix users. Kind of like livekit.
Previews are at https://muc.muoi.me/guides/push.html
Closes #2136
Pull request checklist:
mainbranch, and the branch is named something other thanmain.myself, if applicable. This includes ensuring code compiles.
50418896c8fba109127afba109127a6a59c75c1di was @room-pinged for this, so, bad 👎
@ -18,5 +18,10 @@"type": "file","name": "oidc","label": "Delegated authentication"},May introduce conflicts against removal of oidc page in #2234. Note to resolve manually before merge.
Nice guide! Reading https://muc.muoi.me/guides/push.html#other-unifiedpush-distributors I would like to add a section with sth like:
Nextcloud as UnifiedPush provider
Edit from @stratself: Included uppush + NextPush stack
c8bb9b40d52f092273cec9594dd11563799dcdb663799dcdb65bb286061d@ -0,0 +55,4 @@## Correct output: {"unifiedpush":{"gateway":"matrix"}}```Continuwuity is working on a Web Push implementation following the works of [MSC4174]. This push method allows sending end-to-end-encrypted payloads directly towards the push provider, bypassing the need for a push gateway. Developments of this feature can be tracked in [#2122][pr-2122].s/Developments/Development@ -0,0 +62,4 @@## UnifiedPush[UnifiedPush][unifiedpush] is a common, open notifications system supported by many Matrix clients on Android. Using the same push gateway mechanism as other push services, it requires no additional support from the homeserver side. Below are notes for some known UnifiedPush distributors.I don't think this makes it very clear that UnifiedPush also works on Linux.
Added Linux to supported platforms and fixed wordings
@ -0,0 +65,4 @@[UnifiedPush][unifiedpush] is a common, open notifications system supported by many Matrix clients on Android. Using the same push gateway mechanism as other push services, it requires no additional support from the homeserver side. Below are notes for some known UnifiedPush distributors.:::info UP-ExampleThe [UP-Example] app can be used to test and debug your UnifiedPush installation.Is it worth mentioning that there's also a troubleshooting app for Linux? https://flathub.org/en/apps/org.unifiedpush.Troubleshooter
Thank you, I didn't know this one exists
@ -0,0 +130,4 @@This is likely an issue with one's _push rules_, which can be configured within the Matrix clients. Continuwuity also provides an [`!admin users reset-push-rules`](../reference/admin/users#admin-users-reset-push-rules) command, which restores the rules to the default of notifying for every message.Otherwise, if you find Continuwuity not sending push notifications according to the spec, feel free to discuss in the development room and open an issue.I'd prefer to replace
in the development room and open an issue.within our [support room](https://matrix.to/#/#continuwuity:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org), or open an issue.5bb286061df186e24f56f186e24f562c9b97197e1cb292018f9746d9c0b4docs: Add guide for push notificationsto WIP: docs: Add guide for push notificationsRequesting changes on self
@ -0,0 +126,4 @@[NextPush Android]: https://codeberg.org/NextPush/nextpush-android## TroubleshootingAdd note that issues may exist between any two component of the push system
@ -0,0 +130,4 @@### Push notifications not making sounds/not being sentThis is likely an issue with one's _push rules_, which can be configured within the Matrix clients. Continuwuity also provides an [`!admin users reset-push-rules`](../reference/admin/users#admin-users-reset-push-rules) command, which restores the rules to the default of notifying for every message.Also caused by https://dontkillmyapp.com. Tell people to enable background permissions
@ -0,0 +143,4 @@WARN push{user_id="@user:example.com" pushkey="very-long-string-of-letters" events=1}:send_push_notice:send_notice:send_request: conduwuit_service::pusher: Could not send request to pusher https//push.example.com: error sending request for url (https://push.example.com/_matrix/push/v1/notify)```Then, your server is most likely sending push requests to too many invalid targets.Caused by both expired pushers and/or connectivity issues between server and gateway
4657229517570597f1a5@ -0,0 +1,191 @@import { Tab, Tabs } from '@rspress/core/theme';# Push notificationsTODO: now #2122 is merged, write docs for Web Push itself
Done.
WIP: docs: Add guide for push notificationsto docs: Add guide for push notifications@eleboucher review
Otherwise looks good :)
@ -0,0 +162,4 @@This is likely an issue with one's _push rules_, which determines what events are shown to users as notifications. Check your push rules in the clients' notifications settings and tweak accordingly. Continuwuity also provides an [`!admin users reset-push-rules`](../reference/admin/users#admin-users-reset-push-rules) command, which restores the rules to the default of notifying for every message.Another potential reason may be that background services for push are being frequently terminated by your operating system, a [well-known problem][dontkillmyapp] with many Android-based devices. To fix this, follow your operating system's instructions to allow your Push App (and sometimes, your Client App as well) to be exempt from background restrictions.Should never be needed. I don't know of any Android clients that poll for notifs instead of using push notifs.
Could this also be rebased so CI succeeds?
37b13f54528ce6a3747a8ce6a3747af37f1e74c31b2e54123f37607aee2e@lveneris tagging again for review
i'm halfway in and the reviews are no longer working so i am dropping this for now
@ -0,0 +5,4 @@Matrix clients receive notifications in the following ways:- **In-band notifications**, which are shown when the client actively syncs with the server.- **Push notifications**, which are posted by the server via an external push service to the client. This is commonly used for mobile devices to receive out-of-band notifications, and is the focal topic of this page."which are posted to the client by the server through an external push service. This is typically used to send out-of-band notifications to mobile devices, and it is the focus of this page."
@ -0,0 +7,4 @@- **In-band notifications**, which are shown when the client actively syncs with the server.- **Push notifications**, which are posted by the server via an external push service to the client. This is commonly used for mobile devices to receive out-of-band notifications, and is the focal topic of this page.Generally, push notifications work out-of-the-box with your mobile device's preconfigured setup. The details below are useful for advanced use cases, such as when using an alternative push backend (e.g. UnifiedPush) or selfhosting your own."Generally, your mobile device is preconfigured for push notifications out of the box. The details below are for advanced use cases, such as using an alternative push backend (like UnifiedPush) or hosting your own."
@ -0,0 +11,4 @@## OverviewContinuwuity supports two push methods: using the legacy **Matrix Push Gateway** and the new **Web Push protocol**. The former method is currently supported by more clients, but the latter enables push notifications to be end-to-end-encrypted. They work as follows:"Continuwuity supports two push methods: the legacy Matrix Push Gateway and the new Web Push protocol. The former is currently supported by more clients, but the latter enables end-to-end-encrypted push notifications."
@ -0,0 +16,4 @@<Tabs groupId="push-ops"><Tab label="Registration"><img src="./push-registration.webp"alt="Diagram showing the push registration flow"alt text typically describes the subject of an image. people with reduced vision should also understand what is going on.
Will request re-review once I figure out the alt text
@ -0,0 +22,4 @@A client registers a pusher with Continuwuity with the the following details supplied:- The _pushkey_, which is a unique target URL provided by the push backend that the client hooks up to.should this not be "push key"?
I don't think so
you aren't writing the other fields as they are in the spec, and you haven't put it in an inline code block, so i would expect this to be written normally. you are writing this guide for mortals, not machines
@ -0,0 +23,4 @@A client registers a pusher with Continuwuity with the the following details supplied:- The _pushkey_, which is a unique target URL provided by the push backend that the client hooks up to.- (For Push Gateway method only) The _push gateway_ URL, which is [provided by the client](#push-gateways).these should be more prominent, like "For Push Gateways: The [...]"
@ -0,0 +34,4 @@style={{"max-height":300,display:"flex",margin:"1rem auto","border-radius":"5px"}}/>Continuwuity pushes messages to the push gateway, which then converts it into a suitable format and forwards it to the push provider server and then the push app. This push app then wakes up the client to fetch new message(s) from Continuwuity."new messages"
also consider reworking the first sentence. perhaps this should be split up? like
@ -0,0 +36,4 @@Continuwuity pushes messages to the push gateway, which then converts it into a suitable format and forwards it to the push provider server and then the push app. This push app then wakes up the client to fetch new message(s) from Continuwuity.Finally, the client calculates, against a set of _push rules_, to determine whether the fetched message(s) should be notified to users or not."Finally, the client applies a set of push rules to the fetched messages to determine whether the user should be notified of them."
@ -0,0 +46,4 @@style={{"max-height":300,display:"flex",margin:"1rem auto","border-radius":"5px"}}/>Continuwuity pushes encrypted messages to the push provider, which then forwards it to the push app and then the client. The client then wakes up to decrypt this push content, and if needed, fetches the full message from the server.same advice as before applies to this section too
@ -0,0 +54,4 @@</Tabs>_([excalidraw file of the diagrams](/guides/push-notifications.excalidraw))_should this be in the text, or even the repo?
It should so people can possibly edit it later
i'm still not sure it should just be hanging out in the text, then. having it in the repo is fine
@ -0,0 +60,4 @@### Push GatewaysThe push gateway URL is usually pre-configured by the app. However, some clients (such as Element X) implements [Gateway Discovery], and attempts to detect a push gateway _on the same domain as the push provider_, before falling back to a hardcoded one."implement Gateway Discovery, and attempt to"
@ -0,0 +66,4 @@```txtcurl https://push.example.com/_matrix/push/v1/notify{"unifiedpush":{"gateway":"matrix"}}there should be some clarification here that this is a response, rather than part of the command, in my opinion. the separated line might be enough, though
@ -0,0 +93,4 @@### ntfy[ntfy][ntfy] is an easy-to-install push application, and has plenty of publicly available instances. Its server can also be selfhosted and includes an embedded Matrix push gateway.also "Its server includes a Matrix push gateway and can be self-hosted."
@ -0,0 +95,4 @@[ntfy][ntfy] is an easy-to-install push application, and has plenty of publicly available instances. Its server can also be selfhosted and includes an embedded Matrix push gateway.Some tutorials on selfhosting ntfy can be found below:self-hosting should be hyphenated
@ -0,0 +62,4 @@The push gateway URL is usually pre-configured by the app. However, some clients (such as Element X) implements [Gateway Discovery], and attempts to detect a push gateway _on the same domain as the push provider_, before falling back to a hardcoded one.As per the [spec][spec-push-gateway-api], these push gateways must be available on the `/_matrix/push/v1/notify` path of said domain. To test that a push gateway is accessible by the homeserver, make a request for it from the homeserver's IP:this should begin "Per" rather than "As per"
also "accessible to" rather than "accessible by"
@ -0,0 +73,4 @@### Web PushContinuwuity implements Web Push according to [MSC4174], which generally works out of the box with most push providers. Note that this mechanism does not require a push gateway component.drop "generally"
inconsistent stylisation of UnifiedPush
@ -0,0 +120,4 @@- Push gateway: [common-proxies]- Push server: [autopush-rs]- Push app: [Sunup][sunup]- [Matrix notifications on Android, powered by XMPP][stratself-xmpp], by stratself.is it reasonable to wield an entire separate chat protocol for this purpose? this sounds more like an endeavour for fun
Same with wielding that autopush-rs + valkey + common-proxies stack. This mainly helps people who are already using XMPP
@ -0,0 +114,4 @@[unifiedpush-distributors]: https://unifiedpush.org/users/distributors/Community tutorials for selfhosting some of these stacks can be found below. Unless stated otherwise, they are all tested against Element X Android and the push gateway mechanism (but should be fine with Web Push as well).make the parenthesised clause part of the sentence, like ", but they should work with Web Push as well."
@ -0,0 +187,4 @@Active Matrix clients periodically renew their pushkeys as the old ones expire, and consequently register them against Continuwuity. As these pushers build up over time, the homeserver will keep sending more requests to an increasing number of "dead" push endpoints. This results in the errors seen above, and can heavily impact performance if not mitigated.To work around this issue, the following actions can be made:"made" -> "taken"
@ -0,0 +158,4 @@To fix this, configure `ip_range_denylist` to exclude your push gateway or push server's address from the array, and restart Continuwuity to apply the changes.### Push notifications not making sounds/not being seen"not audible or not displaying"
@ -0,0 +146,4 @@## TroubleshootingIssues with push can arise due to other components of the system that is not your homeserver (for example, the connection fails between the push gateway and the push server). Make sure you check the logs of these components for debugging as well."Issues with push notifications can arise from the components of the system beyond your homeserver (for example, if the connection fails between the gateway and the push server)."
remove "Then, "
@ -0,0 +189,4 @@To work around this issue, the following actions can be made:- Delete all pushers of a user with the [`!admin query pusher delete-all-user`](../reference/admin/query##admin-query-pusher-delete-all-user) command. This command is generally not very disruptive, as active clients will re-register new pushers the next time they log on."all a user's pushers"
"This command is not typically disruptive"
@ -0,0 +160,4 @@### Push notifications not making sounds/not being seenThis is likely an issue with one's _push rules_, which determines what events are shown to users as notifications. Check your push rules in the clients' notifications settings and tweak accordingly. Continuwuity also provides an [`!admin users reset-push-rules`](../reference/admin/users#admin-users-reset-push-rules) command, which restores the rules to the default of notifying for every message."which determine which events"
"in the client's notification settings"
@ -0,0 +156,4 @@WARN conduwuit_service::pusher: Pusher URL is a forbidden remote address url=https://push.example.com/_matrix/push/v1/notify```To fix this, configure `ip_range_denylist` to exclude your push gateway or push server's address from the array, and restart Continuwuity to apply the changes.To fix this, remove your push gateway or push server's address from
ip_range_denylist"@ -0,0 +162,4 @@This is likely an issue with one's _push rules_, which determines what events are shown to users as notifications. Check your push rules in the clients' notifications settings and tweak accordingly. Continuwuity also provides an [`!admin users reset-push-rules`](../reference/admin/users#admin-users-reset-push-rules) command, which restores the rules to the default of notifying for every message.Another potential reason may be that background services for push are being frequently terminated by your operating system, a [well-known problem][dontkillmyapp] with many Android-based devices. To fix this, follow your operating system's instructions to allow your Push App to be exempt from background restrictions."Another reason may be that push background services are frequently being terminated by your operating system, which is a well-known problem with many Android-based systems. To fix this, follow your operating system's instructions to exempt your Push App from background restrictions."
also you alternate back and forth a lot between capitalising various push components and not doing so. pick a style and stick to it
uncapitalizing all.
@ -0,0 +181,4 @@#### Connection issues between the server and the push gatewayVerify that connection to the push gateway is working correctly, which may include checking firewall rules, DNS, and that the push gateway is online. The section on [locally-hosted gateways/push providers](#locally-hosted-push-gateways--push-providers) may also apply to you."that the connection to the push gateway is working correctly. This includes checking firewall rules, DNS, and that the push gateway is online."
f77ddf875992f2a0be3dd1aabb7ec897a12b83c997a12b83c9b326f14f3ab326f14f3a659ed082b1