@p.bhagwan.gaikwad - just following up here. We made a custom widget recently for a customer that does just that (connecting to mqtt broker and Tulip Player). You may already be in the loop on that, but I wanted to share here publicly for anyone else who may find this CW useful.
customWidget-MQTT.js Widget (1).json (13.4 KB)
Some more info:
This CW uses MQTT.js to connect directly to an MQTT broker from the browser/Player and fires events that can be used in App triggers when messages are published. It has some built-in reconnect logic, and hopefully covers most cases of updating the prop values (changing subscriptions, etc), but it’s probably not perfect!
Example architecture for this is below:
Some things to note:
- Only connects to WSS (secure websocket) interfaces on the Broker
- It can only connect to a Broker that is reachable from the Player device (doesn’t use Tulip cloud to connect)
- If you want move to custom Edge Drivers for this use case in future, you’lll want to make sure that your Apps are using the Custom Widget like it’s currently set up: firing events when messages are received, instead of updating writeable props with values. Edge Drivers won’t have a mechanism for directly updating a variable like a Custom Widget can, so that’s this is designed using the “Events” part of Custom Widgets where possible.