I've got an iOS app backed with ejabberd, with a small extension based on offline_message_hook that uses APNS (Apple Push Notification Service) to deliver push notifications of messages that are sent to offline users. This doesn't work out so well for group chats though, so I'm looking for a strategy that would do the same for offline users that are part of a group chat. Do MUCs even keep track of users that are part of the room but offline? Would I need to extend them in some way to keep track of this? Could I subtract the set of invited users from the set of online users to get the offline users? What hook should I be using to do this?
Any suggestions on this or advice on a better strategy are much appreciated!
The XMPP specification for Multi User Chat define MUC rooms as presence based. Per definition, a user is only in a chat room when it is connected. When he gets offline, users gets out of the chatroom. It means he does not receive message at all. This explains why they are not stored offline.
This is for now a feature of XEP-0045. Some future XMPP specifications (aka MUC 2) may address this issue in the future. Currently, MUC + offline storage of message is not possible in XMPP.
Related
I am have an app with push notification implemented in APNs, ie, Firebase has not been used. I need to implement a topic subscription like feature(one present in firebase). Is there a way to implement a topic subscription(One in FCM) or similar option with APNs service? Any heads up is appreciated
I think you will need to manage topic related things on your backend, i-e mobile devices will subscribe to certain topics which are already made at backend, your backend needs to handle all the related things like creating a new topic, assigning respective device token to those topics etc.
I am also looking to work on this
I am using sever to server notifications of ios https://developer.apple.com/documentation/storekit/in-app_purchase/enabling_server-to-server_notifications.
It is giving me the notifications but there are no information that to which user this transaction belongs or who paid for it, so am I missing something or there are other ways to know?
You can only rely on original_transaction_id. It's unique identifier of subscription. In case you have one subscription group it also identifies your user. However you have to implement your own logic by matching your users with original_transaction_ids.
You can also use ready-to-use solution to handle Apple notifications, like Apphud.
I want to be able to send push notifications in my app. But i would like to be able to send them to certain categories like country
any way to do this if there is 25-30 different categories
also a way for somebody to pick a category and then get push notifications for that category
I handle sending push notifications myself, the backend receives push keys from the mobile apps after login, this way I can decide which user I want to send push notifications... This way you can decide how to implement subscription and push mechanism yourself, and check if a user has a topic enabled and is in the specified country.
Anyway: more info will get you better responses: ios? android? external push notification service? used frameworks?
Have you considered using Firebase Topics?
Based on the publish/subscribe model, FCM topic messaging allows you to send a message to multiple devices that have opted in to a particular topic. You compose topic messages as needed, and FCM handles routing and delivering the message reliably to the right devices.
For example, users of a local tide forecasting app could opt in to a
"tidal currents alerts" topic and receive notifications of optimal
saltwater fishing conditions in specified areas. Users of a sports app
could subscribe to automatic updates in live game scores for their
favorite teams.
You could simply subscribe/unsubscribe users from the relevant country topic.
I have followed some tutorials on implementing In-App purchases and subscriptions for iOS (especially Ray Wenderlich) but I have doubts on how to integrate our iOS app with our website so that if someone subscribes to the app they can access the content on the web as well.
Our website and app offer access to videos. All subscribers have access to all videos. Our web works with PHP and MySQL. When someone subscribes on the web, a record for their account is created in our MySQL database and they are flagged as subscribers so that they can access the content.
We want to implement in-app subscription in our app, but we need for a record to be created in our database when the subscription takes place.
The question is, should we do this upon receipt validation (we'll be doing this in PHP)? Also, is there a way to know when a user unsubscribes through iOS so that the database can be updated accordingly?
Our closest example of how we would like it to work is Gaia.
Should we do this upon receipt validation?
Yes, you should wait until you validate the receipt to mark the subscription as active for the user.
Is there a way to know when a user unsubscribes through iOS so that
the database can be updated accordingly?
The correct way to implement this is to store the entire IAP receipt on your server and periodically refresh it with Apple to get the current subscription status. Just because somebody started a subscription doesn't mean it will still be active the next time you check it (e.g. they may have turned off auto-renew or been issued a refund).
This blog posts explains some of the nuances in further detail: iOS Subscriptions Are Hard
Is there a way to know when a user unsubscribes through iOS so that
the database can be updated accordingly?
Use status update notification.
A statusUpdateNotification is a server-to-server notification service
for auto-renewable subscriptions. A notification specifies the status
of a subscription at the time the notification is sent.
As status update notification is not a reliable service, Apple recommend to use this in combination of other method such as polling the verifyreceipt end point. creating a scheduler in server will be best option along with notification.
We have recently implemented group chat functionality for an existing application using Twilio Programmable Chat.
Context: The application allows users to connect with each other and join groups. We are using Twilio to add a real-time chat room within each group so that group members can communicate. So when a user joins a group, he/she accesses the Twilio chat channel, as well as various other group resources.
When a user joins a group (as defined by our app), it seems that they are not considered a member of the group's channel unless they are active in the chatroom (i.e., when app is not in foreground, user is not listed as channel member). We are trying to do find some way to introduce persistent notifications for the group in the Twilio channel (i.e., "John Smith has joined the group" or "Jane Smith has left the group"). In another SO discussion, philnash had mentioned using the Twilio REST API to send system-authored messages with this information, and then manage these messages on the UI side to format them as group "updates". That makes sense!
My questions are:
Do I need to handle sending system-authored messages on our backend? If so, I'll need to add a field to my Groups model to include the Twilio channel SID for the group.
Is it possible to mute notifications for these system-authored messages (which will be formatted as "channel updates")? I.e., is it possible to not send push notifications to users whenever the message being sent is authored by system?
I hope my questions are clear enough. Thanks so much for any answers or guidance anyone can provide for the above!!