IM app, how to ensure the other side received my message? - ios

I am writing a IM app on iOS, and not sure about how to ensure that the other side has received my message. Could anyone give me some suggestions or existing frameworks?

You can have the device that receives a message send data back that confirms the message has been received. Most likely each message would be assigned a unique id that the receiving device would send back so that it knows specifically which message was received.
I am not familiar with Pubnub but looking quickly at their SDK it looks like you can send messages both directions on a single channel, or else you could setup one channel for sending messages and one channel for confirming messages.

Related

How to know that a specfic incoming sms is a reply to a previous outgoing sms?

I am integrating Twilio SMS service where my users are able to send SMS messages to their clients. I would like to be able to link each reply with the sent SMS. In another word, is there any field in the Message Resource that could lead me to conclude whether the incoming message received is related to the outgoing message my user sent previously ? I need same behavior as Email send/reply functionalities.
Twilio developer evangelist here.
There is no way to do this I’m afraid, the SMS protocol has no information about users replying to a specific message. SMS is chronological, you can test this by opening your phone’s SMS app and trying to reply to the second to last message you received from someone. In SMS there’s no way to do that.
The best thing you can do is consider the messages chronologically, and assume that the reply is in response to the last message you sent to that number from the number you sent it from.
I suspect your are interested in this because you need to send notifications and get responses to those notifications and you realised you might need to send more than one notification to a user at a time but still get their responses. The best way to get around this is to use different numbers to send the different notification messages from, then when they reply you can tell which notification they were replying to by the number they sent the message to.

MQTT to check if Message is delivered and other user Online/Offline Status

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.

Receiving notifications from Slack Direct messages

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.

How WhatsApp implements delivery receipts for messages pushed through Push Notifications in iOS?

An user X(Has Whatsapp in Android) tries to send a message to user Y(Has Whatsapp) in iOS when the user Y is offline. The user Y receives a push notification that he has a message from user X. As soon as the push notification is received, user X is able to see the double tick mark in his WhatsApp client. How WhatsApp is able to figure out that the push notification has been successfully delivered to the iOS client ?
It's not really possible to know what's going on without seeing at least a protocol dump of WhatsApp as this occurs, so on with the rampant speculation:
I'd guess that WhatsApp is using Message Delivery Receipts, which rely on the client responding to the message, rather than the server. Since push notifications talk to an intermediate service (e.g., APNS), which itself wouldn't send said receipt acknowledgements, the client running on the device, upon receiving the push notification, wakes up, analyzes the message, and sends the delivery acknowledgement to the initiator of the dialog.
At least, that's how I'd do it, if I were trying to leverage existing standards, which isn't necessarily what WhatsApp is doing.
Whatsapp uses XMPP, which is TCP based. Thus, if the Server is able to get a connection to Y this should ensure that the message has been delivered.
So if the whatsapp server is able to send the message to Y, the message is pushed out of the server. If Y has enabled the extension to send message states, Y automatically sends a repsone to X with the extension "delivered".
I can't really know, but i would say Whatsapp keeps a service in background that detects it. If i am correct, when you close totally the app (from multitask), and receive a message, the other person won't see a received double tick if you don't open the app.

APNS Acknowledgment

I would like to know what are the possible way to identify whether our push messages are finally delivered from the APNS server.I already came up with some information as stated below
APNS is sending up the response codes of the acceptance of push request and possibly giving the error codes if any . for e.g.:If your payload is malfunctioned or device token is missing etc.
There are also a feedback service , with which you can check with and get to know what are push messages or devices tokens, which APNS found it difficult to deliver the messages. for e.g.: Suppose your application is removed from your device etc.
Basically i would like to know how do we acknowledge a particular push message being delivered to the indented device.I greatly hope your views on my problems.
Thanks In Advance,
VishnuPrasad Kalathil.
No, there is no delivery notification and APNS messages cannot be guaranteed to be delivered at all.
The only thing you could do is program your app to report itself once it receives a message to your server.
See this Apple guide on APNS https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW1

Resources