Spark Core API timout issues

Hi!

I am using the Spark Core and its API to communicate with it using a webpage. However, often (almost every time) I start the Spark Core, and it is blinking white (indicating it has a good connection), I cannot get through using the API.

To test this, I have a button on a webpage that uses a POST connection through curl which connects to:
https://api.spark.io/v1/devices/getTime?access_token=xxxxx

In the javascript, I use:

$( "#btnGetTime" ).click(function() {
  $.post('/spark/sparkio.php?'+CORE_ID+'/getTime', {}, function(response) {
     console.log(response);
  });
});

I send the request, but the response gets a timeout.

To be clear: I am able to communicate through the API, just very often the connection times out because the core does not react.

I investigated further, and found that the core does not even receive the request in these instances. So something is going wrong in the cloud. It seems (but it’s difficult to be sure) that after waiting 5 minutes, the core does get connected properly and the commands get through the cloud.

Is it correct that the cloud requires a relatively long time to enable API calls to the Core or am I the only one who’s having these ssues?

Thanks!

I was suffering a similar issue yesterday, trying to get my SparkCore to connect to a local website. When “Compiling & Uploading” to the SparkCore from the webIDE, the serial port would return HttpClient Connection Failed Response status: -1.

In frustration I left it running while I went to get a cup of tea, I came back to find it had successfully connected and would successfully connect from then on, until I compiled and uploaded a revised programme ( I ended up drinking a lot of tea!).

If I include Spark.disconnect(); within void setup(), it connects to my local website first time.

So I’m guessing its trying to connect to the Cloud API, and thats forcing the local connection to timeout?

Hey!

For me I use the Spark Dev application. It works quite well, although it does have some quircks with the compiling and uploading the firmware to the cloud. As I am not using a local website, I will have to connect through the cloud…

I do however also have once in a while issues with the core itself not finding the connection (the led keeps flashing green). The only way to solve this is:

  • either wait a LONG time
  • reconnect the power to the core to reboot it

For now I can live with this issue, but I do hope it’ll go away when we continue with the prototyping…

The other issue really seems to be some kind of timing issue in the cloud. I tried several times to just wait and indeed, the core would after ~2 min allow communication through the cloud. Again, I hope this is something that will be fixed, because this would make customer interaction quite difficult…

You say it has “blinking white light, which indicates a good connection”. Actually, it should be breathing Cyan for a solid Cloud connection. Could you check that?

1 Like

Indeed, sorry :slight_smile: It appears I am a bit colorblind. I saw it as breathing white, but cyan might also be.

1 Like