JSON string from Particle.publish for Mesh Devices

I know I can get a Particle.variable JSON string using a command in my browser like


where passDouble is a defined variable. The very useful output is in the form


which I can parse to display the result of “481” on a web page.

Can we do something similar with particle.publish or does it always produce a server send event? (like a websocket it keeps sending multiple JSON sets of data which is much harder to parse)

My working example code is use Device ID for 1111… and access token for 2222222…
Every 3 seconds my webpage shows the new random number put into the variable “myDouble” and sent as the particle.variable “passDouble”

Following is my web page using async and await to fetch the url

async function myGet() {
     myData = await fetch('https://api.spark.io/v1/devices/1111111111111/passDouble?access_token=2222222222222222')
     myBetter = await myData.json()
     document.getElementById('myA5').innerHTML = myBetter.result + '<br>'
     setTimeout('myGet()', 3000)


<input type=button value=new4 onclick="{

<div id="myA5">...</div>

And the simple .ino is just generating a random number to present to the web page.

double myDouble = 0;

void setup()
  // variable name max length is 12 characters long

  Particle.variable("passDouble", &myDouble, DOUBLE);


void loop() {

    myDouble = random(111, 999);


The reason I am curious is I really like published events and I was wondering about mesh devices and keeping track of 40 devices would be very easy with an organized web page.

First, you are still using the deprecated syntax for Particle.variable().
The current version would read Particle.variable("passDouble", myDouble);

Next, I’m not sure what exactly you are asking.

You cannot request a Particle event the way you request a Particle.variable. That’s comparing apples and pears.
Events are actively published by the device, variables are “exposed” to be requested.
The nearest thing to requesting an event is to trigger a Particle.function or a Particle.subscribe callback that does/initiates the publishing.

Hmm, yes. Particle.publish() is for creating SSEs.

I guess the How-Tos for mesh communication will be revealed in due time and you can expect new functions to be created for the mesh specific communication (internally as well as in-/outbound).


Thanks @ScruffR I never did like the old style, reminds me too much of the agony of having to teach variable pointers to High School kids.

@jberi any idea who is working on updating the Console for the new Mesh devices?

Here is a suggestion for what would be nice if the console could efficiently do what this page can do with Particle.variables. Not a big deal if it can’t my page does the job for me.

Github at

Demo webpage at



which easily expands to whatever size table you need to monitor your Mesh Devices:


Although this is doing a fair bit of communication with the Particle cloud. It’s all about the digital information making things more efficient / better / cheaper for the user.

Yup, the whole team :slight_smile: Thanks for the feedback.