Answer the question
In order to leave comments, you need to log in
How to perform sequential actions after a certain period of time?
There is a conditional file that contains in each line a json array in approximately the following format:
[time, data]
Time - milliseconds, for example:
[0, data]
[840, data]
[2000, data] It is
necessary that after starting the script with the corresponding delay sent data to the user through the socket.
How to implement it correctly?
Answer the question
In order to leave comments, you need to log in
Look for a task manager with the possibility of deferred task processing. For example, kue can queue pending tasks https://github.com/Automattic/kue#delayed-jobs and then write a handler for these tasks that will do something, for example, send data to the user via a socket. You can look for alternatives to kue that work directly with memory if you do not want to bloat the technology stack with radish. But I have not seen more or less popular alternatives.
Read about queues (MQ).
Perhaps an implementation on the database is suitable, but on average it is "more correct" to use a ready-made queue server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question