JavaScript - actualizar en tiempo real

 
Vista:

actualizar en tiempo real

Publicado por JoakoPizarro (1 intervención) el 21/02/2024 15:59:03
Saludos a todos...
Necesito ayudita por favor... Como puedo avisar a un usuario conectado a mi web (JavaScript), que tiene una nueva tarea y que le aparezca un aviso en pantalla, algo similar a WhatsApp... que tecnología nueva necesito aprender... Muchas gracias...
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

actualizar en tiempo real

Publicado por Yamil Bracho (78 intervenciones) el 21/02/2024 16:01:57
Si quieres notificaciones en tiempo real puede usar WebSockets
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

actualizar en tiempo real

Publicado por Bruno (2 intervenciones) el 24/02/2024 19:53:49
Te dejo una porción de código sobre notificaciones:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<button>Notify me!</button>
 
<script type="text/javascript">
	let NotificationOK = false;
	const notifyBtn = document.querySelector("button");
 
    notifyBtn.addEventListener("click", () => {
    	if(Notification.permission === "granted" && NotificationOK) {
        	const title = "Notification";
            const body = "I'm notifying you!";
            const options = {
            	body: body,
                lang: "EN",
                renotify: true
            };
            const notification = new Notification(title, options);
        }
    });
 
    if(!("Notification" in window)) {
    	alert("This browser does not support desktop notification!");
    } else {
    	Notification.requestPermission(function (permission) {
        	if (permission === "granted")
            	NotificationOK = true;
        });
    }
</script>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar