MQTT: Can't receive message bodies
Posted: Thu Feb 18, 2016 8:09 am
Hi everyone,
My apologies if this isn't the appropriate place for this issue, but I'm not sure how to debug it any further. I've been working with the DEV firmware provided by the nodemcu-build service. I'm trying to use the MQTT classes to publish and receive data with Microsoft's new IoT Hub. The good news is that I've been able to establish a connection to the cloud service (generating a SAS token was the biggest hurdle). And, I'm able to publish messages to IoT Hub. However, I'm having some difficulty in actually receiving message bodies. I'm able to subscribe to a topic in IoT Hub. I'm able to catch the "on message" event when a message is sent from the cloud to the node. The event handler fires. I can see the topic data get properly populated; but the message bodies I'm getting back appear as 1 character strings. If I print this one and only one character, I get back \000. And, I can't tell what's going on using a network sniffer as the traffic between IoT hub and my Node is secure. Any suggestions? (If it helps, I'm happy to share the code I'm using.)
By the way, I've tried sending messages with different encodings - just in case that was the problem. UTF-8 and ASCII both produce the same problem (I guess in this case, "hello world" is "hello world" regardless of UTF-8 or ASCII).
Thanks
My apologies if this isn't the appropriate place for this issue, but I'm not sure how to debug it any further. I've been working with the DEV firmware provided by the nodemcu-build service. I'm trying to use the MQTT classes to publish and receive data with Microsoft's new IoT Hub. The good news is that I've been able to establish a connection to the cloud service (generating a SAS token was the biggest hurdle). And, I'm able to publish messages to IoT Hub. However, I'm having some difficulty in actually receiving message bodies. I'm able to subscribe to a topic in IoT Hub. I'm able to catch the "on message" event when a message is sent from the cloud to the node. The event handler fires. I can see the topic data get properly populated; but the message bodies I'm getting back appear as 1 character strings. If I print this one and only one character, I get back \000. And, I can't tell what's going on using a network sniffer as the traffic between IoT hub and my Node is secure. Any suggestions? (If it helps, I'm happy to share the code I'm using.)
By the way, I've tried sending messages with different encodings - just in case that was the problem. UTF-8 and ASCII both produce the same problem (I guess in this case, "hello world" is "hello world" regardless of UTF-8 or ASCII).
Thanks