Particle Webhook Socket Timeout in Error Log

electron
Tags: #<Tag:0x00007fe21cf14810>

#1

Hey All,

What does this error message ESOCKETTIMEDOUT mean? I have multiple electrons sending data every few minutes. All these incoming data triggers a webhook to send data to AWS endpoint. Sometimes few messages return with the above Error message. I am not sure if this is particle issue or AWS issue.


#2

As a rule of thumb, chances are that a lot of questions new users may face have been raised and possibly answered in the past already. Hence one of the steps before raising a question would be to search the forum (see Step 2 in that thread)
https://community.particle.io/t/welcome-using-particle-forums-and-forum-etiquette

This might be worth a read


#3

Yeah mate, though the terrible thing about raising my old thread years later is:

  • The documentation hasn’t been updated, and no best practice architecture has been provided.
  • A indefensibly naive system is still in place where retries occur when a webservice returns a 500 etc. Eventually bringing down the webservice. The web standards way of doing it would be to terminate the particular webhook that error’d as you know, it could be the webservice saying the device isn’t allowed to make that call.

It’s why I’m moving away to a Google IoT stack.

@d.chauhan my recommendations:

  • Never return anything but a 200 to Particle, it will eventually DoS your webhooks. Either:
    – Only only return 200 status codes, easy to do if you’re using say Google Cloud functions. Put an error message in description, but for the love of god use a 200 code or Particle will blow up.
    – Proxy everything through Amazon HTTP gateway, simple reason is you could then use third parties who do sometimes return 500’s like you’d expect to in the 20th century, but then you can force the response code on return traffic within the HTTP gateway status codes mangler.

  • Use a job system, don’t send notifications etc via your webhook. Register a job to send a notification then return completed. Let your job system handle the actual long processing etc. I use Firebase realtime db in conjunction with google cloud functions.