Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Real-time event notification but without Web Socket #152

Open
AlirezaSalehy opened this issue Jan 31, 2022 · 2 comments
Open

Real-time event notification but without Web Socket #152

AlirezaSalehy opened this issue Jan 31, 2022 · 2 comments

Comments

@AlirezaSalehy
Copy link

hello buddies!
I'm wondering if the Arduino web thing library supports any other method than Web Socket and periodic HTTP Get for event handling that is somehow like webhook?
For example when we send "addEventSubscription" message over HTTP
ESP keeps the transmitter's IP then every time an event goes off, iterates over the set of saved IPs and notify every subscribed device with HTTP post/put request.
Instead of having an open Web Socket connection for each event for a while to rarely receive events.

Thanks in advance!
A. Salehy

@benfrancis
Copy link
Member

Hi @A-R-S-D, no the Web Thing API implemented by this library does not support anything like that.

At some point I expect we'll add support for Server-Sent Events to conform with the W3C WoT Core Profile, but that will still require keeping a TCP socket open. It does have a mechanism for automatically catching up on missed events though.

The issue with webhooks is that it reverses the client/server roles. This requires every device to be both an HTTP client and HTTP server, but more importantly requires all Consumers to be both an HTTP client and HTTP server as well. That makes implementing a Consumer as a desktop or mobile app very challenging.

One approach we may consider supporting in the future is to use CoAP, which is built on UDP rather than TCP and has an "observe" extension.

Another possibility being considered for the Web Thing Protocol (standardised version of the WebSocket sub-protocol) is to allow connections to be established from the device side rather than the consumer side, but that again requires consumers to be HTTP servers.

Have you experienced problems with keeping a WebSocket open?

@AlirezaSalehy
Copy link
Author

Thanks for your response and sorry for my late reply.
I defined a property and clients will put their event callback URL on this property then whenever that event goes off, I send the event to the callback URL using PUT method by HTTPClient library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants