2
Good Morning. This is a conceptual doubt. I never needed it, so I don’t know if it works.
Imagine the following situation: I have a script A, where I insert information into the database. This script is working 100%.
I have a B script, where I keep monitoring the information entered in the database. I put a refresh every 10 seconds, to every 10 seconds update the information entered through the A script.
The problem at hand is this. I wish I didn’t need to have this Refresh in the B script, and every time the A script inserted a record in the BD, the B script was automatically updated. It doesn’t even have to be via ajax, it can be via refresh of the entire page.
Perhaps to help visualize the problem, I will talk about the application of the situation. I have a restaurant where the attendants stay by phone, taking orders at the table (SCRIPT A). In the kitchen, I have a monitor where is updating every 20 seconds (SCRIPT B) the items ordered in the hall of the restaurant.
The point is that I don’t want to keep updating every 20 seconds because there are times when the restaurant has a very quiet pace and this would generate unnecessary system consumption (bandwidth consumption, link, system performance, etc.. etc. etc...)
Is that even possible?
Perhaps creating a file on the server when the A script is called. The kitchen page would be checking if a new file exists, and if YES, would do a refresh on the B script. Of course this would cost the server requests every second, but in return it would save the BD unnecessary requests. Perhaps there is something more efficient and better at lower cost. I believe that just a check if a file exists would not be so costly to the system.
– Sam