matrix-org / sygnal

Sygnal: reference Push Gateway for Matrix
Apache License 2.0
153 stars 139 forks source link

UnifiedPush support #340

Open johnlpe opened 1 year ago

johnlpe commented 1 year ago

Please add support for UnifiedPush push notification protocol/standard.

We need push notifications, but we don’t want use centralized online service that read we all notifications, like Android has Google Firebase Messaging Service and iOS has Apple Push Notification service. UnifiedPush protcol is the solution for this. UnifiedPush is open protocol/standard for connection between online service (Application Server) → notification service (Push Server) and notification service’s client (Push Distributor) → application (End User Application). It enables the user to choose the service through he receives his push notifications.

Especially GNU/Linux on mobile is very big need of push notifications and with UnifiedPush we can fix it.

bmarty commented 1 year ago

(FTR Element Android already supports UnifiedPush as an alternative to Firebase, and Element Android X will support it as well, once enabled)

clokep commented 1 year ago

I've transferred this to sygnal, which is the project which implements push (homeservers talk to a push gateway, which sygnal is one of).

richvdh commented 1 year ago

https://unifiedpush.org/users/gateway/#matrix lists some existing push gateways that support push from Synapse. I'm not convinced we need to complicate Sygnal by bolting in UP support.

richvdh commented 1 year ago

Perhaps the OP's request is to support UP more natively in Synapse so that there is no need for a UP gateway? I think that is a thing that is possible and sensible, but I am not familiar enough with UP to know exactly what is required.

This has come up before (https://github.com/matrix-org/synapse/issues/9337) though again that issue didn't make clear exactly what was required.


The reason that APNS and GCM push has to go via Sygnal, instead of happening directly from Synapse, is that for APNS and GCM you have to present a secret authentication key specific to the client application. In other words, you have to use a Sygnal instance which is hosted by the client application author, rather than the HS provider (so the instance at https://matrix.org/_matrix/push should really be https://element.io/_matrix/push, because it is used by the Element applications. Indeed the Matrix foundation does not provide an iOS or Android application.)

With UP, the necessary authentication params can be presented by the client when setting up push -- hence homeservers could do the push themselves rather than delegating to a push gateway hosted by the client authors.

clokep commented 1 year ago

With UP, the necessary authentication params can be presented by the client when setting up push -- hence homeservers could do the push themselves rather than delegating to a push gateway hosted by the client authors.

Ah-ha, I didn't realize this was possible. If this is the request then, I'd say we should move this to matrix-spec...it wouldn't make sense as a Synapse specific feature IMO.

johnlpe commented 1 year ago

Perhaps the OP's request is to support UP more natively in Synapse so that there is no need for a UP gateway? I think that is a thing that is possible and sensible, but I am not familiar enough with UP to know exactly what is required.

Yes, I don't understand, what is the use of separate push gateway? Of course with FCM and APNS it's worth, since you don't want propietary crap in Synapse, but with UP the situation is different.

I don't know where would be best to target these, but I would like:

  1. Matrix homeservers can directly send push notifications via UnifiedPush to the Push Server specified by the user.
  2. Matrix clients UIs expose the push notification confs of the Matrix homeserver.
johnlpe commented 1 year ago

Ah-ha, I didn't realize this was possible. If this is the request then, I'd say we should move this to matrix-spec...it wouldn't make sense as a Synapse specific feature IMO.

IMO each server can decide itself how their deliver push notifications. It's unnecessary to include this in the Matrix communication protocol.

richvdh commented 1 year ago

@johnlpe:

Matrix homeservers can directly send push notifications via UnifiedPush to the Push Server specified by the user.

I'm struggling to understand, based on the UP site, exactly what needs to be changed here. Please could you point to a clear spec for what such a push notification looks like? Or give an example HTTP request?

richvdh commented 12 months ago

Of course with FCM and APNS it's worth, since you don't want propietary crap in Synapse

That is not the reason that Synapse and Sygnal are separate. Sygnal is entirely open-source; there is no "proprietary crap".

clokep commented 12 months ago

IMO each server can decide itself how their deliver push notifications. It's unnecessary to include this in the Matrix communication protocol.

Devices decide where their push notifications should be routed to, not servers. This allows multiple clients to receive push notifications separately using the same homeserver.


Note that it is already possible to use UnifiedPush with Element Android. @richvdh pointed to documentation about this above: https://github.com/matrix-org/sygnal/issues/340#issuecomment-1625354377

ne20002 commented 6 months ago

I tried to setup my own ntfy and it is not working with Element. Looking in synapse-admin the gateway is still matrix.gateways.unifiedpush.org and the key includes the address of my ntfy server. Thus it is that all notifications are send to the external matrix.gateways.unifiedpush.org and then forwarded to my ntfy. I don't want to expose my ntfy, all devices are inside my network (via wireguard). As ntfy can act as a matrix push gateway: how to replace the fixed? gateway matrix.gateways.unifiedpush.org with my ntfy server so that I can use the ntfy server directly?