2 ms·
> - Data can be pushed to clients in real-time (this goes well with reactive UIs). You’ve been able to do that for many years with server-sent events. > - The
by chrismorgan 8y ago
> - Data can be pushed to clients in real-time (this goes well with reactive UIs).
You’ve been able to do that for many years with server-sent events.
> - The server is aware of the client's presence (and can detect the exact moment when they go offline).
You are overly optimistic in saying “exact moment”. You can probably detect when they probably go offline to within a minute, depending on various configuration factors, but they could then immediately come online again anyway.
This much being said: JMAP (https://jmap.io/ https://jmap.io/), an RPC and object syncing protocol sponsored by FastMail and approaching finalisation in the IETF, has used regular HTTP and server-sent events, but one of us has also been prototyping and writing a draft for JMAP over WebSockets; see https://datatracker.ietf.org/doc/draft-murchison-jmap-websocket/?include_text=1 https://datatracker.ietf.org/doc/draft-murchison-jmap-websoc..., the introduction of which also lists two more key benefits of using a persistent connection for the transport: authentication only needs to be done once, and that request bodies can be compressed too. (In conjunction with the whole HTTP/2-and-WebSocket incompatibility matter, I initially informally opposed the effort as needless fragmentation, but when these benefits were pointed out and also that WebSockets will soon work over HTTP/2, I retracted my objections: there are clear and concrete benefits of WebSockets over plain HTTP/2—though they’re admittedly mostly not quite ready yet.)