I am attempting to integrate PubNub iOS SDK in my project. How can I confirm that the published message was delivered?
Message Delivered Notification
If the publish callback status is success, then you know PubNub Network received it and sent it to all active subscribers.
If you want to be notified when a subscriber or each individual subscriber (if there are more than one) have received the message, then the subscriber(s) need to send (publish) a message back to the publisher.
But how many subscribers are receiving the message? Do you want to receive a message delivered notification for all subscribers? Just something to consider.
Related
I am developing an iOS chat messaging App using MQTT, In this App i have to show other user online/offline status and message Send & Deliver Status.
Please help me in this.
Thanks in advance.
Online/offline status can be retrieved in this kind of method.
Checking Active MQTT Client Connections.
This guy uses sensors, but working principle is the same.
Message sent status can be obtained if you're using QOS1 or QOS2, so it guarantees delivery to server.
Message delivered can be done with publishing to the recipient's topic. You are sure that message is delivered, if another client published some sort of acknowledgment.
I have developed one iOS chat app in objective-c, in which when UserA send message to UserB at that time UserB get push notification. When UserB get push notification it is calling one url to my backend to know UserA that your message is delivered to UserB(when app is not running or killed). This all working fine visa-versa.
But my problem is that when UserA sends more than 5-10 message to UserB and UserB is not connected to the internet(my backend is also sending successful message to UserB - via FCM). After when UserB connect to the internet its receiving only most recent notification.
This is because apple is maintaining QoS. I read this article.
So to solve this issue I tried to add apns-collapse-id parameter when sending request to send push notification via fcm. But this is combining only max 4 notification at a time. Also this scenario not working all time. Sometimes getting only 1 message not all.
In short I want to display all the message notification same as Whatsapp displaying all notification when connect to the internet.
Please guide me what to do now to solve this issue.
Thanks in advance.
What you can do in this case is,
Remove all the pending notifications from APNS.
[[UNUserNotificationCenter currentNotificationCenter] removeAllPendingNotificationRequests];
Call a service and Pull all the notifications from your server for particular user.
When you receive the response from your server, show local notifications in your app.
Also notify your server which all notifications you have displayed, and mark them delivered on your server. So that next time you can get all the notifications that are not delivered yet.
If you were to publish to 3 devices in a Topic, how can you get an accurate badge count for each of those 3 devices and pass them through?
e.g.
Device A - unread messages 3
Device B - unread messages 5
Device C - unread messages 10
If i publish a message through to the Topic, each device gets the same payload including the same badge number.
Is it possible to somehow upon receiving the push notification, be able to handle the badge number correctly (if app is in the background) somewhere in the AppDelegate?
Or is the only way to get the correct badge number is sending a message via direct messaging? i.e. instead of sending to a topic, you send to individual device tokens.
Publishers send messages to topics. Once a new message is published, Amazon SNS attempts to deliver that message to every endpoint that is subscribed to the topic.
http://docs.aws.amazon.com/sns/latest/dg/PublishTopic.html
When you publish to a topic, you can supply different formats, but not different messages. All subscribers get the same message. Individualized messages have to be sent directly.
I'm building a simple slack bot and can currently send private messages as well as checking for the last 10 messages received within this one-to-one channel.
Is there a way of getting a POST notification to my webservice whenever the user replies, instead of having to poll and continuously check messages on that one-to-one channel?
Now you can make use of Slack events to receive notifications.
In the give use-case, 'Message' event can be used to capture message received and process accordingly.
https://api.slack.com/events/message
Bots generally work by connecting to the real-time messaging API, a WebSocket-based API that sends you events as they happen. Specifically, you should see a message event sent to you every time a message visible to your bot is sent.
To answer your question, there's no way to get an HTTP POST sent to you instead; you'll need to connect to the RTM API and listen for events that way.
According to this post, the best practice is filtering channel messages on client side. I haven't found a feasible way to do that when push notification is integrated yet. Right now our iOS client gets notified for a lot of useless messages when app is not running.
Filtering PubNub Messages and Push Notifications
This is a shortcoming with APNS, not PubNub. PubNub works in such a way that all subscribers of a channel receive all messages published on that channel. But when an app is in the background on iOS or not running at all, your app does not have the opportunity to process the push notification before it is displayed by the iOS device. Android/GCM does allow your app to intercept the message before it is displayed.
Fortunately, there is only one scenario (that I can think of) where the sender of a msg would receive their push notification version of the message (meaning, you couldn’t intercept and not display it).
user publishes msg
then immediately (quickly) leaves the app (home button, switch to another app, etc)
push msg appears
But if the user stays in the app for a second or two (or long enough to receive the realtime msg AND the push notification), then you can prevent the push msg from being displayed. But there is no need to filter on UUID because you should be suppressing all push notifications from being displayed when the app is active in the didReceiveRemoteNotification delegate, because you already have the realtime message on the subscribe callback.
That link you referenced (Filter Owner Messages on PubNub Data Streams) is only for realtime push notifications and Stephen is calling out a feature that we will be rolling out in the near future which allows you to subscribe to a channel but provide a query that allows you to filter/query condition for the messages on the channel, like, “where uuid != ”, where is the uuid of the subscriber. Then the subscriber would not receive realtime or push notification messages because the server filters them out for you.
For a good overview of push notifications see Sending APNS and GCM Messages to Subscribers and Mobile Push Notification Services in One API Call
For complete push notification setup, configuration and implementation, see the docs for each of our SDKs.
Also, see my answer that describes how to use iOS silent push notifications to do on device filtering. Same thing can be done on Android but no need to do anything special because you always get the opportunity to process the push notification before it is displayed.