In a message notification system, there are comments and replies: {code ...} considering the scalability, I cannot hard write the notification content to be displayed to the database or redis. I can see the "template" mentioned on the Internet. If I simply call the display template based on the notification type, I don't think so...
In a message notification system, there are comments and replies:
-The display format of each notification on the web Front-end is different.-For the same notification, such as comments, the content of the comments on the web Front-end is different, for example, if you comment on a diary or comment on a photo, the display of the Message notification is different.-In addition, there may be several display formats for the comment of a photo;
Considering the scalability, I cannot hard write the notification content to be displayed to the database or redis. I can see the "template" mentioned on the Internet. If I simply call the display template based on the notification type, I don't think so, but I really don't know how to design a database to meet my above requirements. I don't know how to design such notifications?
Reply content:
In a message notification system, there are comments and replies:
-The display format of each notification on the web Front-end is different.-For the same notification, such as comments, the content of the comments on the web Front-end is different, for example, if you comment on a diary or comment on a photo, the display of the Message notification is different.-In addition, there may be several display formats for the comment of a photo;
Considering the scalability, I cannot hard write the notification content to be displayed to the database or redis. I can see the "template" mentioned on the Internet. If I simply call the display template based on the notification type, I don't think so, but I really don't know how to design a database to meet my above requirements. I don't know how to design such notifications?
Provide a solution:
The notification does not contain specific content or contains the minimum amount of necessary information (suchMessage count
,Sender
When the user clicks, the user obtains the specific message content asynchronously.
Take Android push as an example. This is an implementation of our first product. The notification type and user ID are passed, and then pushed to the notification center after resolution is complete. Similar to the preceding description, a minimum amount of necessary information is carried, and the specific content is obtained asynchronously.
Let's talk about how to present the specific notification information.
First, the information stored in the storage must not be the information that is finally presented to the user. The information presented to the user should be assembled at the service layer or on the page. Store or save basic data information, such as the comment content, time, and image link.
The idea was not clear last night. Now let's make a supplement.
The method mentioned above is 1. There is also a message format agreement with the view layer (web, app), and then inservice
Layer to complete message assembly.
Take iOS push as an example: Because iOS push follows Apple's APNs protocol, alter is alter, badge is badge, and the push needs to be passed to the app, It is encapsulated in custom. The web can also be similar, Protocol specific notification format, and then judge and present at the web layer.
This is what I do now. The information to be pushed to users now,
This information is divided into various types. What if redis is used for storage? In addition, how does one read the message records that the user has not read ??