This is what SSE (Server Side Events) is designed to do. A stripped down version of websockets which:
- auto reconnects
- exposes an optional offset
- only allows server -> client streaming
SSE is also supported by most web browsers.
This is what SSE (Server Side Events) is designed to do. A stripped down version of websockets which:
- auto reconnects
- exposes an optional offset
- only allows server -> client streaming
SSE is also supported by most web browsers.
SSE is a simple protocol that you can easily implement yourself both in the server and the client if the client lacks support.
SSE also adds naturally to existing infrastructure of request-response if you only use SSE for notification and keep everything the same, i.e. use same endpoints as before for fetching new data on a SSE notification event, and thus can be turned off as easily if problematic, e.g. too high server load.
IMHO, this unfortunate assumption is not really defensible in $current_year - especially from the multi billion dollar Cloud industry. I'd much more prefer first class support for long-lived connections on an infrastructure level, as opposed to a "proprietary database-level". I don't buy the argument that it's infeasible to solve the thundering herd issues.
[edit]
I looked it up and SSE was a much earlier standard, but implementation of WS and SSE were relatively contemporary with the exception of Opera (had SSE in 2006) and IE (Never got SSE support).
It does feel like websockets tried to cram several novel features whereas SSE was simply giving proper clothing to the existing art of long polling.
In particular, WS is binary encoded, has support for multiplexing/message splitting, several optional http headers, which in hindsight appears to have simply complicated the spec at little-to-nil value.