MQTT documentation

#1

Hi there,
I was trying to find documentation on how to access the device API using MQTT.
I found this link: https://forum.mdash.net/t/remote-control-via-device-shadow-overview/18 but do not seem to have access to.
The official documentation concentrates mainly on the rpc API but one can find references to mqtt as sometimes there are topics and subscriptions mentioned.
Is there any reason why MQTT is not documented more detailed officially?

regards
Marcel

#2

Yes, there is a reason for that.

Currently mDash supports MQTT - i.e. it is an MQTT server. We, however, deprecate MQTT functionality and completely disable it very soon.
See https://mdash.net/docs/#authentication - the Note section.
We suggest https://mdash.net/docs/#notifications as a notification mechanism, and RPC as request/response mechanism.

Kind regards,

#3

Thank you for this information. So the best course of action (future safe) is to use a websocket watcher to look out for notifications and then use rest/rpc calls to update any desired configs?

#4

Precisely that.
Note that the REST API has both “management” and “customer” authentications. You can control which functions are available for the customer-level access.

1 Like
#5

Hi Ism,
let me ask an additional question. As a customer, how would them get access to the notify interface. As far as I understood only the management interface supports notify, meaning I would need to hand a ‘master’ api key with delete and create access to a customer.
Alternatively a customer with around 50 devices would need to cyclicly check all 50 devices which is a lot of workload on client and server side. How can a customer use notify with/for only their devices?

1 Like
#6

Currently, only per-device notification endpoint exists.
Thus, if a customer has 50 devices, a 50 notification connections should be created.
Currently, there is no customer-level notification endpoint.

1 Like
#7

Thank you. So there is an interface for a per device notification. I am in the role of a customer who got informed Friday last week, that the MQTT is going to be deactivated in 2 weeks. I have received the not yet officially documented notify endpoint of a single device but get a challenge/response error if I try to connect with the public key of the device.
Any hints on how to use that endpoint properly?
And let me add, as I do have around 50 devices, might it be possible for our supplier to open an account and move all those devices into this new account so that I could get the master api key?

#8
  1. The notification endpoint is https://mdash.net/api/v2/m/device/notify, authenticated by the device public key. Make a catcher similar to how it is described at https://mdash.net/docs/#notifications
  2. W.r.t. the master key - you can create a new account, create 50 devices, collect their device auth tokens, and ask your vendor to set dash.token to those values. We can help with this - provided your vendor, or you, have support subscription with us
1 Like
#9

Hi Ism,
thank you for your answer and patience.
I got the websocket connection working. Important is that the origin header is set to mdash.net:443.
I receive a continous stream of device states. Is it correct, that I only receive a message, if the actual device changes something from their end in the state (e.g. via an rpc call?).
I will discuss with my supplier what the best course of action might be. Until then, thank you again and have a nice evening, it is evening here were I sit.

#10

Notifications are sent when a device goes online/offline, when its shadow changes, and when it gets or generates an RPC call.