Can I create an auto-reload counter for messages using setTimeout();
to fetch JSON code from test_ajax.php?
Is it possible to send information from the server in this case?
I'm noticing a large number of requests being made to test_ajax.php when I check my Chrome network log (F12 -> network tab). However, websites like vk.com or facebook.com do not make constant requests unless there is a change.
What am I doing wrong with my solution?
UPDATE: Upon further investigation, vk.com sends requests to q%NUM%.queue.vk.com every 25s, but the last request remains "Pending" until then. When a new message arrives, it is displayed immediately. The requests have a "wait" parameter set to 25, which indicates a delay on the server side. How is this achieved?