I'm building a chat application using Node, Express and Socket.io

This is the link to it: https://shahchat.herokuapp.com/

It is a sample test work

For some reason trying to close the popup is reloading it again and again.

Any help or advice will be appreciated


function notifyMe(user, message) {
        // Let's check if the browser supports notifications
        if (!("Notification" in window)) {
          alert("This browser does not support desktop notification");

        // Let's check if the user is okay to get some notification
        else if (Notification.permission === "granted") {
          // If it's okay let's create a notification
          var options = {
            title: user,
            body: message,
            dir: "ltr"
          var notification = new Notification(user, options);

Socket code

 socket.once("notify everyone", data => {
          notifyMe(data.user, data.comment);

1 Answers

Vincenzo Ninni On

You can use Chrome Notification, it works on both Desktop and Mobile sides.