4 ms·
One pattern I like to use is to have a regular /events endpoint, which works for polling. The endpoint also checks the accept header though, and if it sees `tex
by qubyte 5y ago
One pattern I like to use is to have a regular /events endpoint, which works for polling. The endpoint also checks the accept header though, and if it sees `text/event-stream` it'll act as an EventSource endpoint.
EventSource is also nice because you can add cursors, so if the connection drops the source naturally catches up when the connection is re-established. While the interface is browser oriented, there's no reason not to use it in other contexts.