-1

im doing PWA app. How can i detect on frontend if user has closed my app? I do not mean keeping it in background. I want to invoke function on frontend when users close pwa from background processes. Something familiar to window.addEventListener('beforeunload',) but for PWA.

To be specific, i do have a chat app, i want to invoke LEAVE_ROOM socket emit when user has closed my app, i want to allow it work in background and being in queue(im sending user notification), but i want to leave queue when user closed app.

1
  • wouldn't the socket get closed when you close the PWA? Commented Nov 20 at 23:37

0