Skip to content

Web Notifications

Julian Kern edited this page Sep 20, 2017 · 1 revision

Smartnode offers the possibility to send notifications to the web interface. Right now every notification is displayed to every connected visitor.

Those notifications are out of the box used, to let the user know when a client (dis-)connected or a new client registered. Plugin developers and accessory manufacturers can display other messages as well.

To trigger a new notification:

this._webNotifications.broadcast({ // or .send()
    title: 'Client connected',
    message: `${data.plugin} was registered and is ready to be configured!`,
    icon: 'check', // taken from fontawesone.io right now
    autoHide: false, // default: 5, possible: 10, 20
    buttons: [
        {
            title: 'Configure',
            url: `/config/${data.id}`,
        },
    ],
});

There is also a flag .volatile which can be added before .broadcast()/.send() to tell the server that the client doesn't need to receive this message. If no-one is connected, this message will be omitted.

Clone this wiki locally