Spark.publish(), Socket.IO, Node.js, and Angular.js

DEMO APP HERE

I was looking for a way to use the spark.publish functionality along with socket.io to update an angular front end and wasn’t having too much luck. I created a simple project using the particle photon with a DHT22 temp and humidity sensor which publishes to the particle cloud every second. Behind that I built a small/lightweight nodejs server to grab that stream using the spark node module and shooting it over to the front end using the socket.io node module. The front end is insanely basic, built on angularjs and twitter bootstrap along with an angular wrapper for socket.io In the future I plan to add a mongoDB to log the data and probably add a live updating chart. This project was just to show how easy it can be to use socket.io to get the data from the particle cloud to your client. Feel free to fork and make pull requests! The github repo can be found here!

4 Likes

Cool :slight_smile:

Pretty neat :smile:

That sensor has a maximum resolution of once every 2 seconds :see_no_evil:

true that, its publishing each value every two seconds but it alternates so data in general is published every second.