New MeteorJS demos for MQTT and Espruino

July 17, 2014

Tags: #mqtt #meteorjs #espruino #javascript

In the last few days I created two more demo applications on the incredible Meteor platform.

MQTT Dashboard

The first application is an MQTT dashboard (client), which connects to a configured broker and receives the messages for a specific topic. While the messages on an MQTT broker are non-permanent, I'm persisting the messages for some minutes (and purge them afterwards). The last 10 messages are being sent to the dashboard for displaying them. Also, there's an option to publish messages under a topic to the broker.
In the first version I tried to use the JavaScript library of Eclipse Paho, but this is intended for client-usage only and makes use of objects like Websockets, Arraybuffer, etc., which are not part of a Node.js/Meteor server environment. So I switched to the NPM package "mqtt", which does a really cool job! Easy to include and use!
See the sources at GitHub:


Since Espruino is a JavaScript device and Meteor is a perfect JS platform, they fit perfectly together! I used the NPM package "node-espruino" for communicating via the serial port from my computer with the Espruino. The demo shows, how you can control the Espruino from a web client. In my example, you can just toggle the three built-in LEDs (red, green, blue) on and off. Additionally the status of the LEDs are displayed on the client, not based on the action on the client, but on the executed command on the server.
See the sources at GitHub:

Both applications required some asynchronous programming (and thinking), which was not always trivial, because some data propagation has to be done in completely separate calls from the originated call. But thanks to the Meteor Deps options, this became a no-brainer. :-)

Unfortunately, the Espruino does not yet support net or websocket usage (only http). So it can't communicate with an MQTT broker. And since there is no JavaScript client library for MQTT-SN (just C clients), the usage in a sensor network is also not possible, I hope, this will be fixed/supported soon!

Please remember, that these are just demo applications, which I created as a kind of proof-of-concept for other, real-word challenges.

« Avatar.js & Project Avatar - Feedback from conference talks Playing around with the Ehcache Search API »