receive notifications on new message
andremarretto opened this issue · comments
andremarretto commented
Hi,
How can I get a notification when I receive a new message,
there´s a way to activate this feat.?
andremarretto commented
I´ve tried to use:
useEffect(() => {
if (socket.current) {
socket.current.on('msg-receive', (msg) => {
setArrivalMessage({ fromSelf: false, message: msg });
// play notification sound
const audio = new Audio('/notification.mp3');
audio.play();
});
}
}, []);
but It only works if the tab is active