Skip to content

receive notifications on new message #23

Open

Description

@andremarretto

Hi,

How can I get a notification when I receive a new message,
there´s a way to activate this feat.?

Activity

  1. changed the title [-]receive notifications on news messages[/-] [+]receive notifications on new messages[/+] on May 12, 2023
  2. changed the title [-]receive notifications on new messages[/-] [+]receive notifications on new message[/+] on May 12, 2023
  3. andremarretto commented on May 15, 2023

    @andremarretto
    Author

    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

  4. krabhi1 commented on Jul 4, 2023

    @krabhi1

    we can use web push API
    check this link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions