Stream: implementers
Topic: Subscription W3C SSE
Christian Jonigkeit (Jan 23 2017 at 12:05):
Hi @Grahame Grieve in the current build of FHIR the server is responsible for initiating communication regarding Subscriptions see http://build.fhir.org/subscription.html#12.23.6.1. This can be impossbile in many network topologies and require jump hosts. IMO the server also becomes stateful with regards to the client/endpoint.
I suggest looking at Server Sent Events as it overcomes most of these problems. (https://www.w3.org/TR/2011/WD-eventsource-20110208/)
Jens Villadsen (Jan 23 2017 at 12:35):
Also, if one is buying all the way into the HTTP REST principles, web sockets doesn't seem all that clean as it is not based on HTTP and the communication channel changes from an HTTP endpoint to a Websockets endpoint. Websockets seems like a great fit for some event driven architecture but not so much REST
Jens Villadsen (Jan 23 2017 at 14:47):
@Ewout Kramer - have you done any SignalR-prototype with FHIR yet?
Lloyd McKenzie (Jan 23 2017 at 16:11):
Just a heads up that Grahame's on vacation with minimal internet access for the next week or so, so he may be slower to respond than usual.
Jens Villadsen (Jan 23 2017 at 23:18):
Well, @Lloyd McKenzie your opinion is just as valued in this discussion :) - any input?
Lloyd McKenzie (Jan 24 2017 at 00:57):
Believe me, if I had an opinion, I wouldn't have hesitated to share it :)
Jens Villadsen (Jan 24 2017 at 08:22):
@Lloyd McKenzie - there is a pretty good description on https://jersey.java.net/documentation/latest/sse.html#d0e11463 between the different types of eventing mechanisms. That might trigger an opinion of yours ... ;)
Ewout Kramer (Jan 25 2017 at 15:03):
No, I have never played with signalR....
Ewout Kramer (Jan 25 2017 at 15:19):
I can see it supports SSE. What I wonder about is the cost attached to keeping open all these connections for a long time. That might not fit some usecases but not all, so SSE would be an additional choice for a subscription protocol.
Ewout Kramer (Jan 25 2017 at 15:22):
(and "just" as a side note, is SSE still not supported under IE nor Edge?)
Jens Villadsen (Jan 26 2017 at 08:57):
In my experience it is easier to have the server shipping updates out to clients on existing connections initiated by the client instead of having the server to initiate the connection. The latter usually requires multiple firewall issues, whereas the former requires fever. It is correct that the server is required to keep the connections alive - those connections can however be distributed across servers given the proper architecture (a scalable one that is, which aligns with REST principles). (and you are right about the browser stuff - IE and Edge seems to be non-supporters of this, but I wouldn't let those browsers dictate this design).
Jens Villadsen (Jan 27 2017 at 12:16):
@Torben M. Hagensen - any take on this?
Torben M. Hagensen (Jan 30 2017 at 14:34):
We have only had the need for pushing data to clients on mobile devices where we use the push frameworks for Android and IOS.
Ewout Kramer (Jan 30 2017 at 14:37):
Sure! I can certainly see the usecase of client-initiated subscriptions.... I am just getting my head around it and wonder whether there is experience about the cost of keeping all those connections open if you happen to be in a situation where clients connect for days, weeks or months...
Jens Villadsen (Jan 31 2017 at 09:15):
-
Grahame Grieve (Feb 06 2017 at 04:00):
SSE is not on the list because no one asked us for this. There is a profusion of candidates for this, and we need to be sparing in what we add to the list. I haven't heard any specific reason that SSE is better than websockets?
Jens Villadsen (Feb 06 2017 at 22:28):
I won't argue that SSE is generally better than websockets. I would say it has other qualities than websockets (just like rest-hooks, email/sms and so on - email, really?). There is an abundance of discussions and analyses on the sentence "SSE vs websockets" which probably explains is better than me (ie. http://streamdata.io/blog/server-sent-events/ - theres a nice image on http://stackoverflow.com/questions/11077857/what-are-long-polling-websockets-server-sent-events-sse-and-comet aswell). For something called 'subscription' (ie. changes to something outlined in the criteria/(predicate)) SSE sounds like a great fit for an event driven mechanism on a RESTful architecture.
Jens Villadsen (Mar 07 2017 at 22:13):
Allow me to draw the attention to my very rough example implementation of SSE and FHIR combined on https://github.com/jkiddo/hapi-fhir/tree/master/example-projects/hapi-fhir-jaxrs-sse. It does not use the Subscription(and criteria) resource (yet) - but it illustrates how it can work (which it does) :-)
Last updated: Apr 12 2022 at 19:14 UTC