Spark.getVariable vs Spark.subscribe

Thanks @Moors7

It’s a good idea, I hadn’t really thought about combining everything but I agree from a network perspective it does sound better. I followed the tutorial by bko Spark Publish With JSON Data which was super helpful.
One thing I’m not quite sure on, how do I ‘unsubscribe’ from an event listener using the JS library. I notice the Particle firmware seems to have provision for this but the JS library or cloud API don’t.
For me there’s a use case when a customer selects another device to monitor and I’ll need to ‘spark.subscribe’ to another device. In this case won’t the old event listener stay open?

1 Like