0

I have to Push Notifications to all the users who are using OpenFin for my site. As per OpenFin documentation, they have provided API to send a Desktop Notification on an event like button click. But if the OpenFin App is Idle and we need send notifications then how can I achieve that?

I went through the example on this site provided by OpenFin.

Can anyone help with sample code for push Notification in javascript ?

IamBatman
  • 65
  • 8
  • `But if the OpenFin App is Idle and we need send notifications then how can I achieve that?` as in without a user interaction? Put the notification creation in a websocket subscription or something. If the app is open but not displayed, the notifications will still be pushed through. – dcchuck Feb 21 '20 at 15:26

1 Answers1

0

The example provided in the link is outdated as it uses old Openfin API. I suggest you to use latest API for notifications Openfin Notification API

fin.Notification.create({
    url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Notification.create.html',
    timeout: 3000
}).show().then(() => console.log('Notification created')).catch(err => console.log(err));
Varun Goel
  • 341
  • 1
  • 7