How to display Real-Time MQTT Data for Users Using Non-Persistable Entities
0
Hi all, I’m currently working with the Mendix MQTT Connector and using Mosquitto as the broker. My use case involves publishing and subscribing to MQTT topics, and displaying the received data in the UI without storing it in the database. So far, I’ve successfully: Connected to the broker Published and subscribed to topics Received data in the subscription callback microflow However, I’m facing a challenge with displaying the received data in the UI. I’m using non-persistable entities to avoid database storage, but I’m unable to bind the data to the front-end. Microflows: I’ve configured the MQTT subscription microflow to run in the afterstartup event. Below is subscription callback microflow, I’m able to convert the data from string to object and assign it to a non-persistable entity. My intention is to pass this object as context to a page and display the data using a list view. However, since the callback microflow is triggered by the MQTT subscription (and not by a user action), I’m unable to open or navigate to a page directly from within the callback. This has left me unsure of how to proceed with displaying the data in the UI. Domain Model Has anyone implemented a similar setup or can suggest the best approach to display MQTT data using non-persistable entities? Any guidance would be greatly appreciated. Thanks in advance!
asked
Monika Poola
2 answers
0
The easiest (albeit not real-time) solution to update the client would be to use the Events widget (which can also be used for nanoflows) that will periodically trigger a refresh. You can find it here: Events widget in Mendix marketplace
answered
Thorsten Biehl
0
Hee Monika,
You could also maybe take a look into using websockets.