J
J
Jekson2021-05-25 17:35:36
Notifications
Jekson, 2021-05-25 17:35:36

How is the notification system on the toaster arranged?

Interested in how the notification system is implemented on the example of this site (or similar). When I receive an answer to a question, I need to refresh the page to see the notification + a notification comes to the mail.
With what tools and what business logic is used for this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Therapyx, 2021-05-27
@Therapyx

many implementations are possible. A banal and simple example
- When a person presses the "send" button, the text is checked for the presence of the pattern "@Nichname,"
- If so, then
1) Select the user's email from the pattern above
2) Add "flag" to the user's DB, what does he have there is an unread message (it can be used as a counter, for example, what is happening in social networks). And also add all the meta-info about the message.
3) Send an email and information about the message
4) When a user refreshes the page or enters the profile, the DB is checked for the presence of the set flag. If so, it indicates the presence of an alert and retrieves the saved meta-info by the ID of this request.
5) when notifications are read, the flag is reset to zero. And so in a circle.
It's just the first thing that came to mind. As I wrote above - dozens of implementations can be done if you think carefully)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question