What is the principle of regularly pushing messages?

in the advertising system, setting a point in time will automatically push messages to users. What is the general principle of implementation

Mar.14,2021

simply means that you add a scheduled service (crontab), to the server, such as 5 o'clock every day, and then you write a program to send an email to the specified user, and then tell the server to trigger the program at 5 o'clock every day. Then the server will check every second to see if it is 5: 00 sharp, if not, ignore it, and if so, trigger your program. Then your program is responsible for screening users to send emails.


queue to schedule tasks


you have made a ticking time bomb. This bomb is a blank bomb, which does not cheat the dead but implements a function to push the latest news from the news table in your database to the users in the target table. The bomb is energetic, excited and waiting for "boom" at any time, while you tell the bomb that it can only "boom" at 5 o'clock every day. The bomb waited for the time to go by every day, and he couldn't wait to "boom" as soon as he arrived at 5: 00. Why did he keep track of the time so accurately? because the arms factory hired a regular inspector, who was paid a high salary, he always took a stopwatch proofreading list and found out which bomb in the list should be "boom." when he sat on a rocket spaceship made for him by the arms factory, he quickly informed the target bomb, "it's time for you to perform the real technology." And then the target bomb just "boom".


set a time point and call a third-party push tool such as YouMeng's interface, and the latest information will be pushed to the user


it's not clear what the point of your question is.

I'll tell you what I know. Generally, there are two ways to push a message on a regular basis, one is that the client downloads the message content in advance and displays it as soon as the time is up, and the other is through http passive polling or websocket active push, which is nothing to say. If you are asking how to implement the backend, it is also divided into two situations. If it is the first one mentioned above, there is no big problem. You can reply to the client each time that you need to push messages that need to be pushed regularly in the future. The latter is almost the same as the implementation of the chat room. As soon as you have a push plan, just leave the task in the task schedule queue.

Menu