Memmy-App / memmy

An Apollo inspired open-source iOS and Android client for Lemmy built with React-Native. Find us on the App Store and Google Play!
GNU Affero General Public License v3.0
547 stars 58 forks source link

Support for push notifications #944

Open kodxana opened 1 year ago

kodxana commented 1 year ago

Check for open issues

What is the feature that you would like to have added?

For now app there is no option to get notifications on comments etc. Would it be great to have ability to provide own notification endpoint for push notifications.

Solution

Add some way to implement notifications based on open source backend solutions like for example https://appwrite.io/ Not sure how much it possible but is worth to discuss.

Alternatives

Nothing for now.

eoddc5 commented 1 year ago

@gkasdorf can you check in here? Push notifications are a feature and work. But not sure if there’s a different ask here

sgriff96 commented 1 year ago

You can enable push notifications on comments @kodxana. Can you clarify if that was part of your ask? I don't think we will support custom push notification endpoints but maybe @gkasdorf has a different opinion.

gkasdorf commented 1 year ago

Actually, push notifications right now are just disabled. I'll need to rewrite the notifications server because of some rate limits that other instances started putting in place. I'll try to get around to it this weekend.

kodxana commented 1 year ago

I host my own instance so rate limits are not issue. Would not mind hosting own notifications backend :)

gkasdorf commented 1 year ago

@kodxana That was actually a thought before. Regardless, I already have a system planned to handle this. Each separate instance will run on a different thread and manage its own rate limit. I'll do a calculation to put the checks at ~90% of whatever the rate limit is for the instance (I'll need to see if there's a way to get this programmatically, but I've already talked with people from the two biggest instances where this was an issue and have an idea).

So in your case, there wouldn't be a delay at all outside of the (to be determined) base wait period. Probably either 30 seconds or one minute.

gkasdorf commented 1 year ago

@kodxana Also...

Once I write this, I might get ambitious and devise a system where you can run your own server for this. However, it takes a bit more work because the notifications will still need to come from my server. However, instead of checking on my end, you'll be doing the checking and just telling me to send a notification (Apple requires credentials to send notifications and you need to have a developer license to do this.)

So, what I am thinking of doing is the following (although again this is something in the future not imminent)

  1. Create a bot account
  2. You DM the bot account with your APNS that would be provided by the Memmy app
  3. The bot account replies with a secret that you can set in the notifications server
  4. Your server checks for notifications on whatever timeframe you want
  5. When a notification is available, you send a request to my server with that secret
  6. The server dispatches the notification to your device

This would have the added benefit of you not needing to provide me with your JWT (which I honestly do not want at all. I really hope OAuth and scoping gets added sometime in the near future...)