Notification system in html5, javascript

0

I would like to understand more about this system, however, no publication has helped me. I already know how to create a notification

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <h1>Notificações</h1>
    <input type="button" value="Notificar!" onclick="minhaNotificao()">
    <script>
        //Verifica e solicita se o usuario tem permissao para utilizar as notificações do Chrome
        document.addEventListener('DOMContentLoaded', function () {
            if (!Notification) {
                alert('Erro no sistema de notificação, navegador não suportado.');
                return;
            }

            if (Notification.permission !== "granted")
                Notification.requestPermission();
        });

        function minhaNotificao() {
            if (Notification.permission !== "granted") {
                Notification.requestPermission();
            }
            else {
                var notificacao = new Notification("Titulo da notificacao", {
                    icon: 'go.jpg', //img
                    body: 'Mensagem'
                });

                notificacao.onclick = function () {
                    window.open('http://google.com/'); //site
                };
            }
        }

        minhaNotificao();
    </script>
</body>

</html>

However, I would like to create a real-time notification system (without using the site that offers this service). Would you create a database in php and mysql, with the messages, something like that? Would the browser verify this database? How does the notification system work today? Do you need a server? HELP, lost in it.

    
asked by anonymous 01.06.2018 / 00:18

0 answers