Skip to Content
ModulesCommunity

Browser push

The BrowserPush module: site notifications reach a player's browser and phone even while the site tab is closed.

The module gives site notifications one more delivery channel, "Browser (push)". A player subscribes the browser once in the profile settings, and mentions, replies, payments and punishments then arrive as system notifications even while the site is closed. The module has no pages of its own: it plugs into the site settings, the notification templates and the player profile.

The Browser push section in the module settings
DependenciesGamesPermissionsStudio blocksBot commandsCron tasks
Flute 2.0anynone of its own: settings need admin.system, turning off a player's devices needs admin.usersnonenone"Push: removing devices nothing is delivered to", daily at 04:20

Where the module shows up

PlaceWhat is there
AdminExtensionsModulesBrowser pushSettingsthe channel switch, the site keys, limits and appearance
A notification template, "Delivery Channels"the "Browser (push)" channel next to "Email" and "Telegram"
Profile settings, "Browser notifications" tabsubscribing this browser, the device list and the choice of what comes
The player card in the admin panelthe "Turn off push devices" action

Turn notifications on

Switch the channel on

Install the module from the marketplace as described in first steps and open AdminExtensionsModulesBrowser pushSettings. Turn on "The channel is on" and save. The first switch-on creates the site keys, and the line under "Issue new keys" changes to "The keys exist.".

Check the site address

Browsers subscribe to notifications only on https sites. If "Site address" holds an address without https://, the module settings show the "Notifications need https" warning with a "Change the address" button once the channel is on. Changing the address is covered in the general settings. There is no warning for localhost and 127.0.0.1.

Choose what goes to the browser

Out of the box only personal notifications go to the browser: mentions, replies, payments and top-ups, punishments and the player's own tickets. The "Push by default" field decides that. To add or remove a specific notification, open its template in AdminNotificationsTemplates and toggle "Browser (push)" under "Delivery Channels". Templates are covered on the notifications page.

Subscribe your own browser

Open your profile settings and the "Browser notifications" tab. Click "Subscribe this browser" and allow notifications in the browser prompt. Then click "Send a test notification": "Notifications work" should arrive.

Sending goes through the site queue, so a notification arrives after the next scheduler run, or right away when a queue worker is running. See the queue section to set that up.

What the player sees

The "Browser notifications" tab in the profile settings appears while the channel is on. Its name comes from the "Tab name" field.

The Browser notifications tab in the profile settings

The player clicks "Subscribe this browser", and the browser asks for permission once. "Subscribed devices" lists every device with the subscription date and the last delivery; "Turn off" removes one and "Turn off all devices" removes them all. Under "What will come" the player switches off the notifications they don't want in the browser, and those keep arriving on the site.

Once a player has blocked notifications, the site cannot ask again. The tab then says "Notifications are blocked in this browser" and shows where to give the permission back in Chrome, Edge, Firefox and Safari. On iPhone and iPad the subscribe button appears only after the site is added to the Home Screen and opened from there.

A moderator with admin.users can turn off every device of a player from the player card with "Turn off push devices". The action is written to the journal.

Settings

AdminExtensionsModulesBrowser pushSettings. The page address is /admin/modules/BrowserPush/settings. The fields are grouped into "Channel", "Limits" and "Appearance".

FieldWhat it changesDefault
"The channel is on"browsers may subscribe and notifications are sentoff
"Contact for push services"a mailto: or https:// address a push service writes to about a problemempty, the site address
"Push by default"which templates go to the browser until the template is edited: one key per line, * matches anythingpersonal notifications, nothing sent to everyone
"Push services allowed"hosts a subscription may point at, the rest are refusedfcm.googleapis.com, updates.push.services.mozilla.com, web.push.apple.com, *.notify.windows.com
"Devices per account"one more device pushes the oldest one out, 1 to 5010
"Failures in a row before removal"after this many failed deliveries in a row a device is turned off5
"Keep without deliveries, days"a device with no deliveries for this long is turned off, 0 keeps it180
"Time to live, seconds"how long a service keeps a notification for an offline browser86400
"Notification picture"the picture shown in the notificationempty, the site icon
"Test notification"the "Send a test notification" button in the player's settingson
"Tab name"the name of the tab in the player's settingsempty, "Browser notifications"

"Issue new keys" is needed only if the old keys may have leaked. Every subscription is lost after it, and each player has to subscribe the browser again. The line under the button shows how many devices are subscribed and how many notifications were delivered today.

For developers

The module registers the push channel in the engine's NotificationChannels, so any notification template, including one from another module, can go to the browser without code. Delivery to the push service sits behind the Flute\Modules\BrowserPush\Contracts\PushSender contract, with WebPushSender as the default implementation. GET /push/key returns the site's public key to signed-in users. The number of subscribed browsers is exported as the browserpush_devices metric, and a player's subscriptions are part of the personal data export and erasure.

How the core side works: Module metrics.

Troubleshooting

For any other message, use the error lookup.

Notifications are not sent

The site cannot read its notification keys. This happens after the application key changes or the database moves to another site. Click "Issue new keys" in the warning: players will have to subscribe their browsers again.

The subscription address is not one of a known push service.

The browser subscribed through a service that is missing from "Push services allowed". Add its host to the list, one per line; *.example.com covers subdomains.

MessageWhat to do
"Browser notifications are turned off on this site."turn on "The channel is on"
"This browser cannot receive site notifications."the browser has no push support, subscribe another one
"This browser could not be subscribed. Try again later."check that the site opens over https and try again
"No device is subscribed, so there is nowhere to send."click "Subscribe this browser" first
"Too often. Try again in a minute."wait a minute
a device shows "failures in a row: 3"the push service refuses deliveries; past the limit the device is turned off by itself

Next

On this page