0

I am attempting to subscribe to a topic from a node js file.

client.publish('s/us/mqttjs_8303dec3','210,' +Math.random() *10)

I am using this line to publish to a signal strength measurement run on a timer. All good data arrives in cumulocity My question is how do I now subscribe to that topic? How would i do that in mqttlens as a backup?

I am new to cumulocity so any help much appreciated.

Fred

1 Answers1

0

In Cumulocity MQTT is used not as a generic broker where you can publish and subscribe to the same topics.

You currently cannot subscribe on MQTT to the direct data of the devices.

If you (as a device) want to subscribe for your operations you can subscribe to e.g. s/ds for the static operations. Also for the publish the topic can be simply s/us.

I am not sure what the mqttjs_8303dec3 part is in your case but if it is the client identification you can just put it into the MQTT ClientID to associate with the correct device. No need to send it with every publish.

TyrManuZ
  • 2,039
  • 1
  • 14
  • 23
  • hi, thanks for the client ID ive implemented that now, Second, What is the best way then using Cumulocity to receive a measurement from a device? I have tried every version of s/us or s/d in MQTTLens i can think of. I just want to get that number pushed from the cloud to my device, Cheers Fred – user3062970 Feb 10 '17 at 09:41
  • How about http://cumulocity.com/guides/reference/real-time-notifications/ or http://cumulocity.com/guides/reference/smartrest/ (Section "USING REAL-TIME NOTIFICATIONS WITH SMARTREST")? Would that work? – André Feb 10 '17 at 13:48