jmap: read changes as the server pushes them

A JMAP account asked what had changed once a minute, so new mail took up to a minute to show, and a quiet account still cost a request a minute. JMAP servers push changes over an event stream (RFC 8620 section 7.3), which Fastmail and Stalwart serve. Http gains listen, a GET whose reply goes on and is heard as it comes, outside curl's callbacks so what hears it may send requests, and cut off once silent for three minutes, the server pinging every one. The session opens the stream once the session resource is read and reads what changed as soon as a state event names its account, or once the read under way ends. While the stream speaks, the poll only stands in for an event lost, every fifteen minutes; while it is down, the poll is every minute again and the stream is opened again after 5 seconds, then longer, to five minutes.


Author rockorager.dev
Date Commit Parent 442fdad3
+292 -23
4 changed files
+292 -23
4 changed files