0
I would like to understand more about this system, however, no publication 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 website offering this service). Would you create a database in php and mysql, with the messages, something like that? Would the browser check this database? How does the notification system currently work? Do you need a server? HELP, lost in it.
I’m thinking of creating a server in Nodejs... ?
– Luan pedro
I would like to understand the logic of notification system, push notification. How does it work? What do I have to do to create a real-time notification system? Do I need a server? How does the browser check the server?
– Luan pedro
The user would not receive if the page was not open, right :( ?
– Luan pedro
It wouldn’t be useful in my case, thank you :(
– Luan pedro
You might as well use the.site popkit for this. Just add 3 lines of code and the rest you do in the control panel. Full control of views for the user and design. And the best: Unbranded in the footer, fully clean to be embedded in your site.
– Bruno Silva