RocketChat / Rocket.Chat.ReactNative

Rocket.Chat mobile clients
https://rocket.chat
MIT License
2.03k stars 1.18k forks source link

Unified Push with Embedded FCM Distributor #3241

Open genofire opened 3 years ago

genofire commented 3 years ago

Description:

It would be nice if the way of PushNotifications would be use Unified Push on Android. On this way the users could choice if it use google or his own infrastructure for it.

With Fallback to Google's Firebase Cloud Messenger: https://unifiedpush.org/developers/embedded_fcm/

Environment Information:

diegolmello commented 3 years ago

That would be cool, but that's not something we can support on master (multiple push notification services might cause issues). Maybe a specific branch?

genofire commented 3 years ago

For Android, UnifiedPush is an kind of wrapper for every Push notification - like FCM or Gotify. So is there any reason or push notification, why it is not in master.

diegolmello commented 3 years ago

For sure the project looks promising, but we need to evaluate it carefully before making a huge effort to change our apps and push gateway. It's not something simple to do and we have other priorities right now. I'll make sure to keep this on our radar though. Thanks for opening.

foss- commented 2 years ago

On LineageOS without Google Apps push is not functional for RocketChat Android client, which is a rather big shortcoming for an app centered around communication.

Bubu commented 2 years ago

I wanted to add here that Element has shipped unified push support successfully in their android app, so the whole system is somewhat battle-tested by now. The solution they went with is not using the embedded-fcm distributor but letting the user chose between using FCM (the default on the play store release) and Unified Push (in which case the user is expected to have a separate distributor installed). 1 (this link is currently slightly outdated and about to be updated)

This has the benefit of fcm push working just as before without any changes.

I think the whole story is more complicated for RocketChat though, afaik there's no react-native UP connector yet. Also this will likely require changes on the RC server side (but likely not on the RC push gateway, which usually wouldn't be necessary at all in the UP use-case). Specifically it seems that the push gateway is configured server-side in RocketChat, whereas in matrix it has always been defined by the client trying to receive pushes, which already fit the UP model.

Happy to discuss any open questions with you, if that's helpful in bringing this forward.

diegolmello commented 2 years ago

Very interesting. Thanks for the update, @Bubu!

ghost commented 2 years ago

Just stumbled on this.. Maybe webhooks can call nfty to send alerts? I just found what IM playing with today... lol

ghost commented 2 years ago

i have ntfy working under integrations/outgoing. Any time anyone posts in the chat it pings my phone via the ntfy client.. Now the data and message is sent in json format so you would have to write a script to strip all json in bash then forward that stripped message to the ntfy script. All the info is in the json so you can receive a message in Ntfy that says " New message in room: myroom from: bob Message: Testing... Pretty cool!

You can set it to run the script per chat room, per all messages or just mentions.. etc..

pjv commented 1 year ago

Really straightforward dev documentation for adding unified push to an app in parallel with FCM. Would not need to change anything at all for current users. RocketChat users on Android would just suddenly have the choice to use Unified Push for mobile notifications rather than sharing all the information in their chats with Google. RocketChat users on alternative android implementations (Lineage, Graphene, etc) would suddenly be able to get push notifications at all. Win:Win:Win with small development cost.

Overview: https://unifiedpush.org/developers/embedded_fcm/ Library on GitHub: https://github.com/UnifiedPush/android-embedded_fcm_distributor Example App showing how to integrate: https://github.com/UnifiedPush/android-example

diegolmello commented 1 year ago

This is on our roadmap for mid term already.

pjv commented 1 year ago

In case anyone stumbles in here intrigued by what the ghost entered above about using an outgoing integration to throw notifications at your ntfy server/clients, I followed up on that and have a rough solution using an RC outgoing integration. The existing documentation for how to use the script in those outgoing integrations is long on obtuse detail and short (non-existent) on simple, working examples of code. I waded through until I got to the below working script for this purpose.

This script modifies the JSON that the integration sends to ntfy, making it work for ntfy using the Publish as JSON method. Using that method, you do not want to post to the topic endpoint, you instead post to the root endpoint and include the topic in the JSON. This could maybe be fleshed out further to include more metadata from the rocketchat message, and could of course use whatever additional ntfy features you wanted to include in the JSON (ntfy documentation 180 degree opposite of RC docs - super easy to understand how to do exactly what you want to do...) but this simple thing does what I need:

class Script {
  prepare_outgoing_request({ request }) {
    var text = request.data.text;
    var title = 'RocketChat Message';
    request.data = {
      topic: 'rocketchat',
      title: title,
      message: text
    }
    return request
  };
}
SCR-20221206-7nv
bmkor commented 1 year ago

May I know if there is any update? Perhaps just a rough timeline? Many thanks in advance.

cmdflow commented 10 months ago

Would be really great to have app built in ntfy or similar push client. But i guess they won't integrate free push due to they want to sell their pro plans.

stnby commented 1 month ago

Any news from maintainers on this issue? It is very important to us even with a pro subscription. Or its time we fork the android client as RocketChat seems to be ignorant?