'How to let the user know that a new message has arrived?

There are two such tables:

table friends/${id} with fields creatorId and receiverId;

table chat/${chatId}/messages/${id} with fields dateTime, message, receiverId, creatorId, username

How can let the recipient know about a new message he received from a friend?

Need to create an additional field in the friends table or create a new table?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source