Push delivery mechanism #4
Replies: 6 comments 18 replies
-
Hi Hugo, the basic interaction would more or less be like seen here on the graphic. This is how most Push mechanisms basically work I think. We've looked a bit at the pretty new W3C Push API and on JMAP Push. This all only covers a typical Server-Client system. The payload here would not be actual user data. It would only be a trigger for the client containing the servers collection id a user has subscribed to earlier. So the notification provider does not know which data will be transmitted - it only tells the client that it should sync a certain collection of the CalDAV server. |
Beta Was this translation helpful? Give feedback.
-
My original thougts about that: I think server and client have to agree on an available backend. Before subscribing to collections, a client could query the server's Push capabilities and backend. A server reply could look like:
The backend names have to be de-facto standardized. It should be kept in consideration that they will change over time. Then the client selects the best matching backend, for instance google-fcm. Then it can subscribe to collections:
Then as soon as a collection changes, the server executes an onChanged event on all available backends. For this client, the google-fcm backend would send the notification to this client. |
Beta Was this translation helpful? Give feedback.
-
I think we also need to define well a few concepts:
In essence, a client will set up its own target once and deal only with adding and removing subscriptions from that one as needed. I think the name "target" is not very nice, suggestions are welcome. I mostly want to make sure this aspect of the design make sense for everyone. In particular, this approach means that each websocket is a "target", so can also be treated the all the same semantics. |
Beta Was this translation helpful? Give feedback.
-
Maybe also interesting as a delivery backend for Nextcloud: https://symfony.com/doc/current/mercure.html |
Beta Was this translation helpful? Give feedback.
-
There's prior art on the topic here: https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-pubsubdiscovery.txt While it's focused mainly on Apple's notification service, it has the flexibility to support other transports. It might be a good base to work on; the protocol is very clearly described and the design is simple and straightforward. I also know of some few hosted caldav providers that support APN (e.g.: Fastmail). This results in the calendar applications on macOS and iOS getting instant updates when calendar change. It would be worth figuring out if this protocol is what's being used. If it is, then using it as a base would help the same standard work across ecosystems. |
Beta Was this translation helpful? Give feedback.
-
Dropping websocket can be a reasonable compromise here in order to reduce complexity/scope and make all our expectations align a bit better. A good approach is to converge on Web Push. It is standardised in RFC 8030, RFC 8291 and RFC 8292, so is a perfect candidate for something that has aspirations to become a proper CalDav extension. It should also reduce the burden on server developers to implement wildly different mechanism. This also covers standadising the encryption aspect of payloads. For proprietary ecosystems (APN, FCN), there exists pushgarden which is Web Push server and relays notifications to APN and FCN. This also means that dav server developers don't need to worry about integrating with proprietary services. For the Linux side of things, Web Push notifications can be delievered to a Unified Push server (e.g.: ntfy), these are relayed to the on-device distributor and finally to the application. I believe the caldav-pubsubdiscovery.txt spec which I mentioned above is a pretty solid starting point, and we could replace the APN specific fields with WebPush-specific fields. |
Beta Was this translation helpful? Give feedback.
-
For vdirsyncer (and probably for other native desktop/server applications), having a websocket where messages indicating updates are sent would be the logical choice. It builds on HTTP (which is already the base here), and should be usable by clients without additional infrastructure (aside from the CalDav server itself).
However, I understand that for Android and iOS this MUST go through a third party server which then relays connections. Support for UnifiedPush aligns very closely with those requirements too, so I think it makes sense to keep these three in the same bag.
Is it even feasible to have a proxy service connecting WS->Apple and WS->Google? It seems that the client implementation would be messy, since it's not the client itself that subscribes to notifications, but this unusual proxy.
To summarize this a bit, a client can subscribe to push notifications with a server, but may want one of two approaches:
On top of this, the webhooks themselves need a payload format specific to what Apple/Google/UnifiedPush expect. Again, the only thing that comes to mind here is a proxy that does this conversion, since I can't imagine an extension to CalDav taking into account the nuances of these third party services.
I'm curious to hear more about what kind of designs you have in mind; I'm sure you've given this aspect a lot more though.
Beta Was this translation helpful? Give feedback.
All reactions