-
-
Notifications
You must be signed in to change notification settings - Fork 10
-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to enable group chat push notifications? #145
Comments
Hi, thanks for the report :) As noted in the release announcement:
We've made good progress on this, but a couple of to-do items remain to be implemented. I'm hoping to finish that this week, and then we'll be launching a new server release. That release will also add the app store link to Snikket invitations for the first time. |
Thanks for answer, but it is confusing me :) |
Background In the beginning, the notification mechanism was the XMPP connection. XMPP is a real-time protocol designed around a persistent connection to the XMPP server. Early mobile XMPP apps just kept a connection open permanently (automatically reconnecting if the connection dropped), and they would notify you if you received a message. However as the smartphone market grew, many kinds of apps were developed. Many (non-XMPP/communication) apps also wanted to notify the user about various things. Many of these apps were not designed efficiently - they would use too much bandwidth and battery power. Mobile OS vendors (Apple and Google) began gradually restricting what applications could do. At first your app would be terminated by the OS if it used too much CPU or network activity in the background. Apple allowed an exemption for "VoIP apps" (some XMPP clients added VoIP support just to be allowed to continue running in the background). However Apple eventually removed even this exemption. In current releases of iOS and Android, the rules are stricter than they have ever been. People judge phones partly based on battery life, so this is one obvious reason for these restrictions. Obviously they couldn't just remove the ability for apps to generate notifications, so they developed the concept of "push notifications". The OS itself would maintain a single connection to a notification service (both Apple and Google run such services). If app developers want their app to show a notification while it is not in active use, the app developer can submit the notification to the push service, which would relay it to the device. Ironically, Android and iOS both used XMPP for this push service connection. Android now uses a custom (protobuf?) protocol, iOS I'm not sure (but they still use port 5223 at least - the traditional port for XMPP+TLS). Now that these push services exist, Apple and Google want all your notifications to go through them. They want apps to never maintain an open network connection, or perform any unnecessary background activity. Instead if your app receives notifications from the network, these have to go through the push service. Strategy 1 Now, rather than redesign mobile XMPP clients to tunnel everything through these push notification services, a clever hack was introduced. The client connects as normal, and registers its push notification info (app id, etc.). Eventually the OS will terminate it when it is in the background, and the connection will be closed. Instead of logging out when the OS terminates the client, the clients let the connection drop. On modern XMPP servers using XEP-0198, this would keep the client session appearing online for a period of time, even though the client was not connected. In Prosody we call this a "hibernating session". When a hibernating session receives some (even relatively unimportant) traffic, this would generate a push notification via Apple/Google. When the OS receives the push notification, it would allow the app on the device to run and handle it. Clients would use this opportunity to reconnect to the XMPP server, resume their hibernating session (a feature provided by XEP-0198), and retrieve any pending stanzas (queued up for them by the server). The notification is not shown to the user (but if any messages are fetched from the XMPP server, notifications are generated). The app would then continue to run for a while longer, until the OS decides to terminate it again. This leads to a situation where the app is quietly running for a while, terminating, reconnecting, running for while again, terminating, and so on. On Android this constant reconnection has a workaround - the app can register a persistent notification. On many (but not all) Android devices, this will minimize the chances of the app constantly being stopped by the OS. There is no such workaround on iOS that I'm aware of. Benefits:
This approach has some downsides:
Clients using this strategy: Conversations (and forks), ChatSecure, Monal (pretty much all) Strategy 2 The alternative is to play the game the way Apple and Google want you to. Use push notifications only for messages that should be shown to the user. Don't connect to the XMPP server unless there is a reason (i.e. the user opens the app). Benefits:
Downsides:
Clients using this strategy: Siskin, Snikket iOS Because this strategy requires changes (such as encryption of push notifications), it currently only works with Tigase (and, just about, Prosody) which have implemented these changes. Eventually these changes (or equivalent ones) will hopefully make it through the XSF standards process, and be more widely adopted by all servers. Why did we choose strategy 2? Due to the required changes, it's more work to get it working right in the short-term, however I believe strategy 2 is the "correct" approach due to its increased efficiency and future-proofness. I think that makes this work worth doing. In an ideal world we would be able to just keep an open connection to the XMPP server and apply optimizations ourselves, but the reality is that today the rules are dictated by Apple, Google and other vendors, and we don't have many choices here. I know this is very long, but I even missed out some details - such as how Apple/iOS has different types of push notifications with different characteristics. It's a minefield, and we're doing the best we can :) |
Very thanks for this great explanation. Now I've seen everything :) |
Thanks a lot for this thorough explanation. Apparently the group chat notifications still do not work in snikket-ios but this issue is closed. Is there an open bug somewhere, so that I can test this feature when it's closed? |
We're working on a new server release, it should be published this week. It will be announced on the Snikket blog, Mastodon and Twitter. |
Thanks for your efforts. What should be done to make pure prosody-stable compatible with this feature if it is possible? |
@tpikonen In case you missed it, the release is now available: https://snikket.org/blog/nov-2021-server-release/ @gertyq Prosody 0.11.x cannot work with this because a core change was required. This change will be in Prosody 0.12 which we hope to release "soon" (coming weeks/months, as time allows). Apart from that change, the MUC service needs mod_muc_offline_delivery and the user's host needs mod_cloud_notify_extensions. There are also two Snikket-specific modules, mod_snikket_client_id and mod_snikket_ios_preserve_push - these work around some issues I discovered recently that affect all Siskin and Snikket pushes from Prosody in certain edge cases. Unfortunately they are a bit hacky, and specific to the Snikket iOS client, which is why they are not in prosody-modules like the others. I want to develop a standard cross-client solution in Prosody and the app, hopefully by early next year (but releasing Prosody 0.12 takes priority for now). Hope this helps! |
Thanks again for your work. I'm also interested in this feature in pure Prosody. Did I understand correctly that Snikket-IOS group chat push notifications will not work on Prosody version 0.12, but maybe on 0.13? |
@tpikonen they will work in 0.12 with the necessary supporting modules (which will not be included by default, but will be easily installable). You can try this today with Prosody trunk nightly builds for example. |
Thanks, is it possible to build trunk version for arm? |
Yes, Prosody trunk packages are built for ARM on Debian/Ubuntu. See https://packages.prosody.im/debian/ |
I have converted deb package to alarm and after solving several dependency problems, I was finally able to run it with all modules mentioned above.
At this time I have disabled this module and all we need works now. Thank you for your efforts and good luck with the next stage of your work. |
Ensure you have a recent (within the past ~2 weeks) trunk nightly build of Prosody, and add this option under the
I really can't explain this one. It says a |
I have some questions about Push notifications implemented in Snikket. I have prosody server and before 30 Sep all iOS clients were ChatSecure. All push notifications (1:1 chats and group chats) worked. But I noticed that ChatSecure is not supported now (also because push notifications don't work) and tell all iOS users to delete ChatSecure and install Snikket. Now push notifications work but only in 1:1 chats. What should I change in prosody configuration or tell to change Snikket users in the app for enabling group chat push notifications?
What I understand now:
mod_muc_offline_delivery
, but for now we don't need this feature, we just need receiving pushes when the user in the room.push-ios.snikket.net
which should send to iOS device.But it doesn't. In all cases it is something like:
So as I see there hibernating state doesn't cause sending pushes. In 1:1 chats it cause.
I was trying to load
mod_muc_cloud_notify
under the global modules_enabled list, under the MUC component list and under both lists but in all these 3 cases after restarting prosody and re-registering pushes on clients nothing changes. Although as I mentioted above ChatSecure app was able to send pushes with this config earlier.All Snikket clients have inactive toggle
Push notifications
in group chat settings:Also in account/server settings all Snikket clients have
When in Away/XA/DND state
toggle inactive:Is it normal? And in some cases one of Snikket iOS clients stay Available even when hibernating although another clients stay Away (as far as I understand is expected) - is it wrong app/iOS config or it is normal and it happens sometimes?
prosodyctl about
output:The text was updated successfully, but these errors were encountered: