How does Instagram and/or messenger “know” when a message has been seen or if someone is typing?

537 views

[ad_1]

How does Instagram and/or messenger “know” when a message has been seen or if someone is typing?

In: Technology
[ad_2]

It is part of the protocol. If someone reads a message or is typing their app will send this information to your app (via the server).

Ooh I was just reading about this.

This is the publisher-subscriber pattern (pub/sub).

When you send a message, you are the publisher and send your message (plus headers) to a server. It sees who the corresponding subscribers are (i.e. the recipient) and forwards the data to them.

Now to answer your question, your device sends a message saying it has seen the latest message, which gets passed to the server and forwarded to the sender. *In summary, read receipts just another message that you don’t send by pressing return.*

The same behavior happens for typing notifications, but is a lot more frequent. The reason the notifier still exists after the writer types “kitties be cute”, but deletes all of it is that the message saying field not empty is not sent/received fast enough.

If you do wish to implement these, a lot of libraries and StackOverflow posts exist so you don’t have to do the heavy lifting.