Closed marcosmarf27 closed 6 months ago
I've been researching this as well and even emailed some of the contributors but nothing has come up as yet.
Service Workers, for now, do not support playing of sounds. Below is the workaround I use.
In my Service Worker, when I receive the push (when the push event is fired), I post a message (instructing to play notification sound) to any open window/client being controlled by the service worker. Then, on the app side, I have a listener that should receive the posted message from the service worker. Once the message is received, I check the instruction from the service worker (I have several other kinds of instructions for other things/actions though). If the instruction is to play notification sound, I then play it from the open window (app).
Limitation: it works only when a window of your site/app is already open before the push arrives.
Make sound in the push notification.
Does anyone know how to issue push notification?