-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add More Scalable Event Mechanism(s) #468
Comments
Just make sure to know that Web Hooks implies Consumers having Server functionality so it adds another type of requirement. It would make the TDD more cloud compatible but make the Consumer implementations complicated, i.e. no browser could be a TDD consumer with Webhook events. Why not mention websockets in this case? |
SSE and WebSockets aren't much different in this context. SSE on HTTP/2 is actually more scalable than WebSockets because of the multiplexing capabilities. One major problem with both is the implementation of QoS which is necessary for sleeping devices and a burden for servers. IMO, a broker-based pub-sub protocol such as MQTT is most appropriate and widely used. See also #134. |
I agree with what has been said above. To me, those are all valid use cases we should try to make the spec flexible enough to include MQTT-based TDDs or Webhook (rather than cloud I think webhooks should apply better in any microservice scenario). On the other hand, this complicates the implementation of a generic consumer but this is not the first time that we introduce optional methods for similar functionalities (e.g. for search we have XPath and JSONPath). |
Having looked at HTTP-based event mechanisms in great detail for WoT Profile, it isn't quite as straightforward as Webhooks being more scaleable than Server-Sent Events. There are circumstances under which Webhooks scale terribly or simply aren't possible. Server-Sent Events:
Webhooks:
WebSockets:
In short, Server-Sent events works best for subscribing to high frequency events from a small number of Things whereas Webhooks work best for low frequency events sent from a large number of Things (but only if the Consumer can act as a web server). WebSockets have the benefit of being able to share a single connection between all interaction affordances of a Thing (or even multiple Things/Directories from the same origin), but still require a separate connection per origin. Although it would certainly have scalability benefits for events, a non-web protocol like MQTT is not well suited to all of the other interaction affordances exposed by a directory. Requiring directory consumers to support both HTTP and MQTT would add significant implementation complexity. Also bear in mind that specifying multiple event mechanisms may harm interoperability, if some directories or some consumers only support a subset of the mechanisms. |
The current document says the following: "The rest of this section describes the implementation details on top of the SSE protocol. Realizing the notification functionality using other protocols such as MQTT are possible and may be formalized in future versions of this specification." So - how about MQTT for eventing? This was also mentioned as an option for heartbeats, see #164 |
One possible solution here:
|
I think CoAP Observe might be simpler, but any protocol that has an observe pattern as primitive should do. |
Currently SSE is required to be used for event notifications, but it's not very scalable, and an alternative like Web Hooks would be useful when a TDD is implemented as a cloud service.
See also Issue #417
The text was updated successfully, but these errors were encountered: