Fetch data from MQTT client via Phoenix

It’s simply a way to decouple Phoenix from the “application”:

The mqtt client is already persisting all incoming data from the broker to a database which can be queried by phoenix.

“MQTT client” typically refers to a library that allows you to communicate with an MQTT Broker.

This is the part that is confusing me:

mechanism to communicate from phoenix to the MQTT client and vice-versa

By your description I’m imagining a Phoenix application that is using something like tortoise to talk to the MQTT broker.

So your Phoenix application should already be “seeing” all the messages.

Since I also want to send live data to a client I want a mechanism to communicate from phoenix to the mqtt client and vice-versa.

I assume “client” refers to the “web client”.

What is preventing you from propagating the information live, in parallel to storing it in the database?

Or are you possibly talking about the dash communicating directly to a particular IoT device? That seems to be an MQTT problem - this article talks about faking P2P on MQTT.