Jquery simultaneous duplicate chat notifications

0

Hello, I have a chat system that gives notifications in any part of the site in which it is or in the same page of chatt, however when I have 2 open tabs I get notification in both, that is, duplicate, I would have some way to verify if I have more than 2 open tabs of the same site in the browser to be able to filter and show only one?

    
asked by anonymous 12.06.2017 / 18:36

1 answer

1

I suggest changing your service that returns the messages that will be notified, so that when you return a message, mark it as "read" (one more field in the message table). And when you return messages, you will only search for unread messages.

This way when the first tab receives messages and displays them on the screen, they are marked as read on the server. And the second tab will not receive any messages, as they will all be read already.

    
12.06.2017 / 18:43