Events log using curl API vs Webhooks Performance Comparison

Hey All,

I have few electrons which publish data. I am using Webhooks to forward data/store data into databases. Recently, I figured out that using curl command like curl https://api.particle.io/*** **, I can live stream data published by the electron in the terminal. I can write a code to store data into the database with this curl method also.

My questions are:

  1. What are the pros and cons of both methods?
  2. Can I trust the curl method to run with persistent connection?
  3. What if the curl command stops working? Do I get an error message? I want to keep running this process in the background, which should run 24/7.

Note: I can not afford losing data in any method. The Webhooks are working perfectly as for now. But I want to explore this new curl method also.

Thanks in advance.

curl is a tool mainly targeted at testing stuff. If you want to have a 24/7 client subscribing to SSEs you should rather use/write a piece of code that can be tailor made for your needs (e.g. connection monitoring, reconnect, fallback, …)

For that you may want to have a look at the Particle SDKs
e.g.
https://docs.particle.io/reference/SDKs/javascript/

2 Likes