this post was submitted on 14 Dec 2023
9 points (80.0% liked)

Lemmy

12572 readers
26 users here now

Everything about Lemmy; bugs, gripes, praises, and advocacy.

For discussion about the lemmy.ml instance, go to !meta@lemmy.ml.

founded 4 years ago
MODERATORS
 

So I’m developing a mobile client using React Native, where I’m utilizing Lemmy’s messaging functionality as well. This makes it extremely crucial to have notification support (including push notifications).

How are you guys dealing with this problem? This is what I think an elegant solution could look like. We would need to achieve two things:

  1. Bring back websockets only for notifications by directly changing lemmy server side code.
  2. Find where the email notification code is at, and simply implement expo notifications there.

Whaddya think?

top 8 comments
sorted by: hot top controversial new old
[–] poVoq@slrpnk.net 8 points 11 months ago* (last edited 11 months ago) (1 children)

Webpush or UnifiedPush would be the answers, but neither is currently supported by Lemmy.

Edit: but please don't abuse Lemmy's DMs as a sort of instant messenger. It's not meant for that and also insecure. It's meant to be asyncroneous like email at most and you don't need push notifications for that.

[–] UraniumBlazer@lemm.ee 1 points 11 months ago (1 children)

Webpush or UnifiedPush would be the answers, but neither is currently supported by Lemmy.

I see. I was looking at the Novu project that seems to be working with expo notifications as well. Have you heard of it before? If you have, do you know how it is different from Webpush? I tried researching on this, but didn't really find any answers.

please don’t abuse Lemmy’s DMs as a sort of instant messenger

I'll tell you what the problem is. I think that a Discord x Reddit platform would be absolutely perfect. Chatroom conversations that can be indexed by search engines + posts would be very cool imo. E2EE can be worked on relatively easily for private messaging (I've tried it with no real problems). Chatrooms for communities with different channels can easily be done by creating a special post for every community, where all replied under it are the chat messages (sorted by new). This can make stuff like megathreads much easier and much more accessible.

Unfortunately, there just are no alternative to make this possible. Matrix is a PITA to implement in react native, and not indexable. To implement XMPP by E2EE-ing it, it too is a PITA for react native. Plus, we would have to deal with separate databases, separate logins, registrations, different MFA, etc.

This is why I decided to go with Lemmy's DM thing. I would have to somehow E2EE it, which I would have to do for the alternatives either ways. Which is why I see much potential in working with this.

[–] poVoq@slrpnk.net 2 points 11 months ago

I don't agree that this is something needed, but if you decide to work on it anyway, maybe try to make it compatible with Pixelfed's Sup. https://github.com/theSupApp

[–] Max_P@lemmy.max-p.me 5 points 11 months ago (2 children)

Ideally it would support WebPush which would allow your app to register with any push notification service that supports WebPush.

WebSockets would drain battery and also add a lot of load on the servers to handle all those connections. Implementing specific notification services directly on Lemmy isn't quite where it belongs. Plus you don't want all Lemmy admins to have to register to Apple Push and Google's FCM and potentially others. With WebPush you can have your own server as a relay and then dispatch to expo/APN/FCM as needed.

[–] Die4Ever@programming.dev 4 points 11 months ago* (last edited 11 months ago)

There's a discussion here https://github.com/LemmyNet/lemmy/issues/2631

@UraniumBlazer@lemm.ee

Other apps are currently just polling for notifications every hour or so, works fine for now

[–] UraniumBlazer@lemm.ee 1 points 11 months ago (1 children)

Oh, so does it already do this?

[–] Max_P@lemmy.max-p.me 2 points 11 months ago (1 children)

I don't think it supports WebPush at the moment, no. But it would be the technically correct way to implement this. It's an open standard that's not tied to any particular company and ecosystem.

[–] UraniumBlazer@lemm.ee 1 points 11 months ago

Sorry, I know I should look this up (trust me, I tried but couldn't find an answer), but does Novu use the webpush protocol/standard/whatever it is? I'm interested in Novu as it does seem to be supporting Expo notifications.