My website have the intention to in the background (when tab is not in focus) constantly check, with an interval of maybe one minute, with a server by making web requests to that server, and get a response back, if the message sends back a message, i.e not an error, the website should send a push notification / desktop notification.
I tried and succeeded with registering a service worker that was caching some background files, but I didn't know if this would be to any help as I didn't find any information about how to proceed from installing the service and creating a function that constantly checks information with a server and then display a message.
How can I resolve this?