Discourse Push Notifications for Desktop


(Jeff Wong) #1

The Push notification plugin allows users to opt to receive receive push notifications over desktop devices in addition to mobile devices.

:warning: In order for this plugin to work at all, your Discourse MUST BE HTTPS!

The plugin repository is at github.com/discourse/discourse-push-notifications

While push notifications for mobile are now supported in core by default, they are applicable for mobile devices such as Android only.

This plugin exposes a user option that allows users to prefer push notifications on desktop devices:


When checked, enabling “live notifications” will prefer push notifications on desktop devices.


Desktop browsers are able to get “desktop notifications” which work just fine! However there is a subtle difference in the way that the two function. With desktop notifications, the moment that you close your tabs to discourse, notifications cease to come through. With a push notification, this is not the case.

With push notifications, it is not necessary to have a browser tab open in order to receive notifications. A user is able to receive notifications even when there is no browser tab open on the Discourse site.

Supported Browsers

Chrome Desktop 51 and up, Firefox Desktop 44 and up, see caniuse for specifics.


Be on a recent version of Discourse running HTTPS, then follow Install a Plugin.

Wrong avatar is shown

Are you suppose to get push notifications for all things that you would get notified for with numbers in the avatar bubble (i.e. also watched topics) or only replies and @usernames?

(Jeff Wong) #5

Yes, any watched topics apply as well. A good rule of thumb here is you will receive notifications for anything you would be notified about via email. So events like @ notifications, PMs, watched topics/categories, but not when someone likes your post.

(also keep in mind that the push functionality is now a core feature as of today – this plugin is now only for those who prefer push notifications on their desktop as well)


This just happened - I was writing out a new topic on meta when a push notification (also for meta) came in. It flickered a bunch before settling down. I’ll follow up if I see something like that again on my site or here.

EDIT: Happened again - was on a different tab. Notification flickered 2 or 3 times. I’ll try and find time with someone to test this out.

(Jeff Wong) #8

Hm, I haven’t noticed that behavior in my time working on this. What browser are you using?

Shot in the dark, if you unsubscribe, and re-subscribe, does that resolve the flickering?

I’ll look into a cause for this, thanks for reporting back!

We’ve repurposed the plugin so that there wouldn’t have to be any name changes.

Regarding your issue with no notifications and not being able to re-enable, are there any associated error logs that you could share?

(Jeff Wong) #20

This was due to a bug in core with push notifications - It started happening to me too, and was the most noticeable on desktop. Fixed here: FIX: de-duplicate push subscriptions - ensure unique user/key · discourse/discourse@7f1f697 · GitHub

(Stephen) #21

Thank god, I was getting three at a time. Nice to know it’s going away.

On the other matter above, @featheredtoast and I figured out via DM that there was some kind of key issue at play. We wiped out those variables and when they were regenerated on the next restart it all began working.

(RBoy) #22

Okay I’m a little confused now. I see three things and all are official:

  1. Live notifications in the notifications tab of each user (no plugins installed as yet)
  2. Push Notifications for Desktop (this plugin)
  3. Discourse Push Notifications plugin

How are these 3 different?

(Jeff Wong) #23

Sorry you’re right, I should have unlisted the older plugin earlier. It was repurposed once notifications were available on Android by default.

Discourse has slowly been improving in notification delivery and now supports desktop notifications (for desktop browsers), and push notifications (for mobile/Android) out of the box. The older push plugin used to add this.

This plugin allows a user to allow push notifications on desktop. The difference is that push notifications can notify a user even when they have no browser tabs open.

If all of this sounded like gibberish and you’re still confused, the builtin notifications are probably all you need for notifications, and you don’t need to worry about plugins :wink:

(Michael Friedrich) #24

Hmmm, so if Discourse core now supports browser notifications on desktop as well as push notifications, I would need to remove the two plugins here?

I’m seeing endless notification popups when the browser tab is closed, reproducible with yesterday’s build, Chrome 66, macOS High Sierra. I haven’t dug any further into logs on why notifications are sent that often, but it may be related to a worker not clearing the queue and pushing a notification multiple times. Or the browser does foobar, I have to admit, browser notifications are a whole new thing for me, hard to debug.

(Jeff Wong) #25

Push notifications for desktop devices are not available in core. That’s what this plugin is for.

As for your issue, what do you mean by “endless” – screenshots or a video/gif would be nice here. Does it only happen when the browser tab is closed? Does it fix itself when you have a browser tab open?

Any reproduction steps would be good as well.

For an immediate fix, try toggling the live notification settings off and on again.

(Michael Friedrich) #26

Thanks for clarifying. Took me a bit to create a recording.

Versions involved


dnsmichi is my primary account, netmichi is just for testing.


The notification problem does not go away if you open the tab in the seconds the popups appear. This seems just to be asynchronous e.g. Discourse already pushed the notifications and Chrome displays them one after the other.

I’ve also tried to explicitly enable and disable “Prefer push notifications on desktop”, makes no difference.

When I explicitly disable “live notifications”, test again, and then enable them again, the problem vanishes.


I’ll keep watching it - the problem might only occur after a while and also be Chrome/macOS specific. Thanks for the help so far :slight_smile:

(Jeff Wong) #27

And you’re sure that the plugin version is up to date? It was a known bug in a previous version, but it’s been fixed, and I haven’t seen this since – Is it happening on meta as well?

(Michael Friedrich) #28

Tested a bit further with meta. On Fedora 28 with Chrome and Gnome, this works ootb. Similar thing with Chrome and macOS. So this really only affects/affected monitoring-portal.org - not sure if it is still the case after toggling live notifications and rebuilding the entire site, but I’ll watch further. Hopefully it magically resolved itself :slight_smile:

(Flaviu) #29

Dear @featheredtoast,

If I have a single sign on forum on a website were people agree to get Desktop notifications, how can I configure the notifications into discourse with an API/web call?

Is it possible?

(Jeff Wong) #30

I’m not sure what you mean. What does SSO have to do with notifications? You are trying to send out new notifications?

If so, no that’s not possible. These notifications are only an additional way of receiving the existing ones in discourse, not a new method of messaging your users.

(Flaviu) #31

I know that desktop push notifications are allowed by the user per browser.

If Discourse is running in a folder, and the user accepted to receive push notifications outside of Discourse from the same domain where Discourse is running, then, how would Discourse will know if the user has accepted to receive push notifications. I don’t have a very good understating of how push notification works, but I had the impression that Discourse under user preference should know that the user enabled the push notification. So, in my case this acceptance happens outside of Discourse, so I was wondering if it is possible to configure this user preference from outside of Discourse too.

It may not be related to SSO, but with a way of enabling push notification from outside of Discourse.

Here you can see at what I am referring at


or here in the user account

(Jeff Wong) #32

Let me see if I’m understanding you. You have some kind of site that prompts for notification permissions and user(s) accept there, and you want to know if notifications will be turned on when the same user/browser navigates to your Discourse in the same domain?

If that’s what you’re asking, yes – Discourse will automatically subscribe you to notifications if you’ve given permission to it on the domain.

I’m talking about this “wants to show notifications” prompt:


Underneath, web applications are able to query what permissions the user has accepted for the domain it is running under. Discourse sees that it already has permission to subscribe users to notifications, so it will automatically enroll the user.

(Flaviu) #33

Thanks @featheredtoast

In this case it seems that I don’t have to do anything and it should work out of the box. I will do some tests, and let you know if I encounter any problems.

(Dan) #34

Why this isn’t built-in by default?