Answer the question
In order to leave comments, you need to log in
How to request data from the site with a certain frequency?
How the mechanism for requesting data from a web server works. That is, for example, as in mail applications, when a message arrives at an email address, it is also displayed in the program.
In general, how to properly monitor data on a web server?
Answer the question
In order to leave comments, you need to log in
Options:
1) In a separate thread, every n seconds send a request (GET / POST) to the server and see what he answered you
2) Open a socket connection with the server and wait for it to send you something.
Too general question.
Client programs simply perform checks at a specified frequency (by timer). For example, a mail program can make requests to the mail server every ten minutes and, if there are new letters, download them.
On websites, when using AJAX , this works similarly. The page loaded into the browser periodically makes requests to the server (in the vast majority).
function Checker()
{
$.get("http://localhost/естьчо", // проверка наличия данных на сервере
function(result)
{
alert("что-то есть");
window.setTimeout(Checker, 5000); // вызов функции Checker через 5 сек.
});
}
window.setTimeout(Checker, 5000); // вызов функции Checker через 5 сек.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question