[nodebb-plugin-desktop-notifications] Desktop Notifications (like GMail)
Just to be clear, a tab is open when you are testing the notifications, right?
@PitaJ yes. I tried mentions and chat, no notifications
@PitaJ I'd be more than happy to help. Without notifications that work on mobile a forum will have a very hard time to take off/be an alternative to facebook and whatsapp.
@PitaJ I have literally no clue what happened, but it works now.
All I did was disable the addon, wait a few days, reenable it and restart nodebb
Ok after a few days of testing:
- After allowing notifications the tab has to be closed and reopened for them to work.
- I can't find a way to make them work on Chrome mobile or the PWA.
- Chat messages play the sound on mobile... sometimes. I think the chat has to be opened for this first.
- There are no desktop notifications for chat messages
I'm pretty close to giving up and moving to another forum software... which would be a real shame since NodeBB offers everything else that I need and I wrote an LDAP plugin.
@meredrica notifications will only work if the page is open and connected to the internet. We don't have a serviceworker or anything like that for delivering push notifications.
Chat messages don't create a notification for each message received (to avoid notification spam) , instead only creating a notification after a set delay after the last message received, if it isn't read in time. They should produce a sound every time, though. If this is not the case, please open a GitHub issue.
Potentially there's a use case for a service worker to check for notifications, perhaps that's something we can look into.
On the sounds front, however, I'm a little on the fence about whether we should keep them. Not many apps use sounds, though I think there are more than a few people using NodeBB who would appreciate us keeping them around.
That said, I think we'd need some new sound assets
@julian I think it would be a good idea to implement the worker. Maybe add it to the notification plugin? Or maybe a web worker, I'm not sure if that wouldn't be better.
Service workers can become very complicated and if you have bugs in them they are very hard to get rid of. I would not use them if you don't want to have offline functionality.
@meredrica I don't think there's an instance where a timer or webworker would stay alive when a websockets connection wouldn't. Depending on how often we want to poll, opening a new connection periodically could be more expensive than just keeping the socket connection open.
@PitaJ any way I could contribute to the plugin? I can write the worker but I don't have the time to figure out the internals of nodebb right now.
@meredrica what are you planning on writing? A serviceworker?
@PitaJ Yea that's not a big deal to do really. I just need to know the API I should be polling client side. Maybe check if sock.js is connected and don't poll if it is.
I'm searching for a forum software with push notification support which works with closed browser.
That is possible with web push api and service worker as shown here:
That example isn't pinned to FCM, MCS or WNS and it used the push service based on the browser / device.
If the plugin is still compatible it should be added a service worker to get offline / closed browser notifications working.
IMO it's a feature for a separate plugin - not this one. This plugin, as the description suggests, is using Notification API, and not Push API.
A Push API-based notification plugin would be great, but it's not just an upgrade to this one as Push API works in fundamentally different way by using a service worker.