# Direct connection from Electron to AWS SQS

**URL:** https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982
**Category:** Libraries
**Created:** [September 21, 2016, 10:55am UTC](https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982 "2016-09-21T10:55:34Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![GrtVHecke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/grtvhecke/32/1622_2.png) [@GrtVHecke](https://community.particle.io/u/GrtVHecke)
#### Post date: [September 21, 2016, 10:55am UTC](https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982/1 "2016-09-21T10:55:34Z")

</div>

For some different reasons, I can not use the Particle Cloud, the main reason i that in case of network failures I can not losse data (I need to log it) and send it to a cloud system afterwards (with the correct timestamp).

So for each measurement I need to add the timestamp of the measurement (not necessarily real-time).

I wanted to use AWS SQS, but this requires a https connection (with a certificate). Is there any way we can achieve this on the electron?

Kind regards,

Geert

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [September 21, 2016, 11:19am UTC](https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982/2 "2016-09-21T11:19:11Z")

</div>

Hmm, I don’t quite follow the logic 😕  
You _can’t_ use the Particle Cloud due to possible network failures, but you _can_ use AWS SQS despite that network failure?

But for the HTTPS part of your question, there are several threads (when you search for _HTTPS_) that will either

- direct you to webhooks,
- direct you to the Glowfish HTTPS library,
- refer you to mbedTLS/DTLS, or
- tell that this is not yet possible with out any of the above

---

<div class="post-metadata">

### Author: ![GrtVHecke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/grtvhecke/32/1622_2.png) [@GrtVHecke](https://community.particle.io/u/GrtVHecke)
#### Post date: [September 21, 2016, 11:39am UTC](https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982/3 "2016-09-21T11:39:35Z")

</div>

Sorry, maybe I did not correctly express myself…

Of course if I have a network failure, there is no connection to the AWS cloud either.

But in case of a network failure, I save the measurement with it’s timestamp to eeprom. When there is again network connection, I want to send the measurement with it’s saved timestamp as 1 record to SQS. In case of the particle cloud I can not do that because if I put the value to the cloud (variable) it automatically gets assigned the current timestamp and not the timestamp the measurement was actually taken.

Does anyone have an example / working project with the Glowfish https library and mbedTLS/DTLS?

Thank you for your reply,

Geert

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [September 21, 2016, 12:30pm UTC](https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982/4 "2016-09-21T12:30:15Z")

</div>

When using webhooks (via `Particle.publish()`) rather than `Particle.variable()` you can send the timestamp with the value (even multiple timstamp/value pairs at once) as a JSON.

---

<div class="post-metadata">

### Author: ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)
#### Post date: [September 21, 2016, 2:05pm UTC](https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982/5 "2016-09-21T14:05:56Z")

</div>

I’m pushing data into Microsoft Azure Table Database using Event Hubs to receive the Webhooks, and then Stream Analytics to take that data and push it into an Azure Table Database. This setup can scale to 1 million events per second without failing.

If you have to send to Amazon and bypass the Particle Cloud then, you should look at the Adafruit WICED Feather since it does support the secure MQTT TLS data transfer, but you then loose all the great Particle cloud features.

---

<div class="post-metadata">

### Author: ![GrtVHecke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/grtvhecke/32/1622_2.png) [@GrtVHecke](https://community.particle.io/u/GrtVHecke)
#### Post date: [September 22, 2016, 10:25am UTC](https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982/6 "2016-09-22T10:25:50Z")

</div>

@ScruffR @RWB thank your for your replies. It really sounds an interesting technology, but however the use of Particle.Publish() together with a Webhook does not solve my problem.

Please let me explain:

1.) The Particle.Publish() solves the timestamp issue when there would be a connection problem between the Electron and the Particle Cloud --\> Good

2.) The Webhook is in this case the point of failure: If there is a problem with the amazon system (load balancer problem, EC2 instance problem, or just a plain network failure between AWS and the Particle Cloud), the the Webhook will not be triggered and the value (together with it’s timestamp) will not be stored in the AWS system.

So the total solution comes back to the same, there is a level where we can loose data.

Either I need to be able to push data directly to AWS in some way (or another provider), or Particle Cloud must foresee in data storage, triggering, alarming by SMS and push messages. Or the Particle cloud should have some sort of que system that only gets emptied when the messages are really processed by another system. But this is not the case (so for).

If anybody has any ideas, it would be nice to hear from them

Geert

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [September 22, 2016, 10:31am UTC](https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982/7 "2016-09-22T10:31:18Z")

</div>

> [@GrtVHecke](#):
>
> So the total solution comes back to the same, there is a level where we can loose data.

Unless you only discard your saved data once you got confirmation of it being stored, either via the webhook response (which would require the AWS server to hand back to the webhook - which other services do), or by reading back at least one of the newly added datapoints (via another webhook).

So there are other options than these

> [@GrtVHecke](#):
>
> Either I need to be able to push data directly to AWS in some way (or another provider), or Particle Cloud must foresee in data storage, triggering, alarming by SMS and push messages. Or the Particle cloud should have some sort of que system that only gets emptied when the messages are really processed by another system. But this is not the case (so for).

---

<div class="post-metadata">

### Author: ![GrtVHecke](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/grtvhecke/32/1622_2.png) [@GrtVHecke](https://community.particle.io/u/GrtVHecke)
#### Post date: [September 22, 2016, 10:33am UTC](https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982/8 "2016-09-22T10:33:06Z")

</div>

@scruff can you please elaborate a bit more on how you see this please. If it would be too much you can send a private message as well. I am interested on how you see this (if other values are coming during that same time as well).

Thank you and kind regards,

Geert

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [September 22, 2016, 10:43am UTC](https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982/9 "2016-09-22T10:43:55Z")

</div>

I haven’t got any experience with AWS as such, but only the general functionality of webhooks and `Particle.publish()`/`Particle.subscribe()`, so I couldn’t help you with the _how-to_.  
There are others with more AWS specific answers - I’m more the general (bigger picture) or run my own server guy 😊

But pushing out datapoints to webhooks (and awaiting a related subscription to confirm completion of the task) can be done one-by-one while still collecting new incoming data.  
You’d just need to have some sort of FIFO buffer where you add to the head new data points while pushing out and if successful pulling off the historic data.

---

<div class="post-metadata">

### Author: ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)
#### Post date: [September 22, 2016, 3:40pm UTC](https://community.particle.io/t/direct-connection-from-electron-to-aws-sqs/25982/10 "2016-09-22T15:40:21Z")

</div>

@GrtVHecke Have you checked out [www.Ubidots.com](http://www.Ubidots.com) yet? You can publish directly to their service without using the Particle Publish events.

I’m pretty sure you can send data to Pubnub directly also. [https://www.pubnub.com/](https://www.pubnub.com/)

Also when using Particle Publish, you get an Acknowledgement that the webhook was received successfully so you know if the data was delivered or not and you can then use some sort of buffer that ScruffR was talking about.
