I am currently making a simple clock in and out system for staff. The warehouse has a TV with a list of names on the right of people who have not signed in, and a list of names on the left of those who are signed in. When they clock in on the scanning device downstairs I need the TV/dashboard upstairs to update and move their name onto the appropriate side.
I have made the function that logs the details into the database. And I know I could use code such:
<meta http-equiv="refresh" content="3;url=thecurrentpagesurl" />
And doing that would refresh the page run a function that checks for changes and updates the display accordingly, however I was wondering if there was a way of "listening" for a change without having to spam the server to often. Ideally I want the dashboard to update in real time.
Using meta refresh I can refresh the page use a function to check for db changes and update the html on the dashboard accordingly. Is there a less resource intensive or more efficient way of doing this?
(I'm not a JavaScript expert but I have enough understanding to use some at a basic level).
Edit
This question has asked before and I have looked at the other answers which is why I came to the conclusion about the meta refresh aspect, but what I wanted to know if there was a more efficient way of doing it given my specific set up.