How to implement whatsapp messenger using MQTT?

I want to implement the messenger in the same way as whatsapp using the MQTT protocol. What tutorials should I read?

I got confused in a few things:

  • How do I implement a messaging theme structure? (I am currently using / domainname / phonenumber / (If phone A sends a message to phone B, it will post the message to / domainname / B /)
  • If client B goes offline and goes through the Internet after a while, how will he receive a message sent to him (subject / domain name / B /) when the client was not online?
  • How to implement sent / sent / read confirmation?

I understand that these are very simple questions, but, unfortunately, I could not find any resources that would be directed, although the first steps.

Conclusion:
After talking with people who have already deployed large-scale messengers in MQTT, I came to the conclusion that MQTT should only use the protocol. Pub / Sub is good to start with, but you should have a layer of your own business logic for flexibility and performance. However, you can implement most of the requirements for the main messenger using pub / sub tree, but you will be limited to this, and it will be difficult to extend later.

+4
source share
1 answer
  • The theme structure looks fine, but it should probably have an ACL so that clients can only subscribe to their topics.
  • "cleansession" true, , , , .
  • MQTT Sent/deliver/read, , 2 , . , , .
+4

Source: https://habr.com/ru/post/1607335/


All Articles