How does Facebook utilize MQTT, when it is topic based? - facebook

I am learning about MQTT, and came across an article, which stated that Facebook utilizes MQTT. However, I cannot understand how it is utilized, when MQTT is topic based. Does that mean the broker creates a new topic each time I create a new chat? Wouldn't that lead to an overload of topics? If I understand it correctly, the people chatting would be publishing and subscribing to the same topic.

Facebook uses MQTT for Messenger Chats. Each "Chat" has a generated Topic, and all members in the Chat subscribe and Publish to that generated Topic. The MQTT Messenger Broker infrastructure is made up of "many" different Brokers, and a "Topic Director" steers the Chat MQTT packets to the Broker handling that chat.

Related

How to subscribe for a topic and receive packets from server using websocket flutter

I have code in the server that sends data and I need to subscribe to the topic that the server has and then I need to get data packets from the server. I have no idea how to subscribe to the topic and get data in flutter. please help in subscribing topic and getting data from the server using WebSocket flutter.

Message brokers - "message has been read" acknowledgment solution

I am implementing a service that dispatches messages to clients using an arbitrary message broker. A single user may have multiple clients and the message will be dispatched to each one of them. Once the user has read the message on one client, I want the message removed from the user's other clients.
Do message brokers typically implement this functionality, or will I need a custom solution?
For a custom solution, I was thinking that the broker could maintain a separate reply topic to which a client will deliver a message to say that the user has read the message. The service can consume messages on this reply topic, and dispatch another message to the user's other clients that tells them to remove the message.
Is this how such a solution might typically be implemented?
If it helps, I am considering using MQTT as a message protocol.
There is no concept of even end to end message delivery notification in the MQTT protocol1, let alone read notification. You are likely to need to implement this your self.
If I was doing this I would have 2 topics per user something like this:
[user id]/msg
and
[user id]/read
I would make the payload of the messages delivered to the [user id]/msg contain a message id. I would then publish the message id on the [user id]/read topic. All clients would subscribe to both, that way they could easily mark as read/remove messages as they were consumed on other clients.
1confirmation for higher QOS levels are between the publisher and the broker and then between the broker and the subscriber

How to get mucroom offline messages

How to retrieve mucroom offline messages from openfire and any plugin available for this one?
Thank you,
You cannot. Multi User Chat in XMPP is presence based. When you are online you get the message. When you get offline, you leave the room and will not get anymore message until you join the room again by sending a presence message.
Update: With ejabberd 16.09, you can now use MUC/Sub protocol to subscribe to chat rooms. When subscribed, you do not have to join the room again to receive the messages. Protocol is documented here: https://docs.ejabberd.im/developer/xmpp-clients-bots/proposed-extensions/muc-sub/

jabber-net and vysper message broadcast facility

I have establish chat communication between two users using jabber-net xmpp client and vysper server by apache.
I am looking for broadcast facility using the same.
There are different mechanisms for "broadcasting", a word which I understand as "sending one message which is distributed by the server to many receivers".
When a user changes his "status" (for example "do not disturb me - I'm coding") a so call "presence" message is sent out which is distributed to all his contacts. This is a broadcast, and presence messages are intended to do that in XMPP.
There is at least another popular possibility: multi-user chat ("MUC"). MUC has the notion of "rooms", where users can "enter" to become part of a "conversation". Every message sent by one of the participants is sent to all others.
There are more similar mechanisms available, depending on what you actually want to do.

Bosh multiple streams with strophe as a client

I am trying to build a group chat application by using Bosh over XMPP and stophe as a client. I am very new to Bosh and I have following questions
1) Does stophe support bosh multiple streams out of the box?
2) For every user, there would be a one bosh session with their own stream ? or for one chat session there will be one bosh session with multiple streams ?
Example: I have user1, user2 and user3 who are part of chat session. So there will be one bosh session for chat session which will be shared by all the users or every user will have their own bosh session
Thanks,
Avinash
I strongly recommend you this book:
Professional XMPP Programming with Javascript and JQuery - Jack Moffitt
And in special this chapter:
Chapter 8 Group Chatting: A Multi‑User Chat Client......165
I'm sure that all the answers for all your questions are there.
I'm building single chat an application javascript+strophejs just reading this book.
Good luck.