Question: Is MQTT capable of saving messages to database


Is MQTT capable of saving messages to database

Answers 2
Added at 2016-12-26 15:12

From my research MQTT brokers only save the most recent message but facebook uses MQTT in its messenger app. So are they using a custom broker to retain the messages?

My question is it possible for mqtt brokers to retain all messages sent so that I can create my own chat messaging mobile application? I know that paid services like HiveMQ offer this functionality but I am looking for a free alternative.

Answers to

Is MQTT capable of saving messages to database

nr: #1 dodano: 2016-12-26 15:12

MQTT is a protocol for sending and receiving messages between a client and server. What either does with the messages beyond the basic requirements of the protocol will be implementation dependant.

You could use a application subscribed to a topic to store all messages in a database - it does not have to be a function of the broker component.

nr: #2 dodano: 2016-12-26 15:12

The usual MQTT broker works in a passive manner. It gets the message from publishers and forwards it to any available subscriber. I think Facebook uses another process that receives the messages and then sends it to the clients again. The clients then can send another MQTT message when it receives the message.

However, MQTT has some QoS mechanism. It's possible to use it if there's a persistent connection to the client. Facebook may be making use of that too.

In case you need message persistence out of the box, it's not possible with MQTT though. You can use a technology such as Apache Kafka.

Source Show
◀ Wstecz