Concatenate Spark.variable()?

Since the docs say we are limited to 12 cloud variables, is it common practice to concatenate variables when you need more?


targetTimesString = String(targetTime1)+":"+String(targetTime2)+":"+String(targetTime3)+":"+String(targetTime4);

Hi @scsc_tech

Spark.publish() and Spark.variable() are two different things with a push and a pull model for data transfer.

Spark.publish() pushes from the core:

  • Spark.publish() is rate-limited to once a second on average with a burst of 4 allowed

  • Spark.publish() is limited to a string size of 64 chars

  • You have to format your data (int, double etc.) into a string (char*) to publish it.

  • There are no limits to how many different event types (the first string) you can publish so you can have “targetTimes1” to “targetTimes100” if you want.

Spark.variable() is pulled from the core:

  • Spark.variable() for a string (char*) variable is limited to 622 chars

  • Spark.variables can be used for char*, int, boolean, and double types.

  • The number of Spark.variables you can declare is limited as you say

  • The fastest rate you can read a Spark.variable from the web is around a couple of times per second, depending on where you are relative the to the cloud and how busy the servers are.


Gotcha. I was reverting a bit in my code (in my head) I think you picked up on that. Now that I am using Spark.Publish() for my target variables I wont have that particular problem.

I do want to be able to poll other variables however, so my original question may come in to play at some point.

At the same time, my target variables come in a burst of 8 at the end of the round. are they queued or dropped if they are over 4? Maybe I need to space the publish out as the targets are hit and then reveal them on the webpage when i get a push of roundEnded?