read the documentation VK, and did not understand anything.
is also not clear: for which in the script to use While
.
It seems like.
As I understand
- GetLongPollServer
- Get the answer
- process
If time has run out. We create a new request getlongpoll
.
If an event: do what you need.
And send a request to the VC on the server that received in the getlongpollserver
request. And + add TS
in the query
Why do While
?
If we make a request to VK.
And VK sends the answer.
It turns out: that VK comes to the site and sends JSON
.
Just like in Callback
.
Tell me please.
And better attach an example.
I know PHP normally.
But I know Longpoll badly.
Callback medium
Answer 1
In the case of Callback
, VK itself sends requests to the processing site. Longpoll
runs in the opposite direction: the application sends a request to VK to get the list of events that occurred
While
is needed to send the following long query (as well as change the timestamp, starting with which you want to get the events, the most field TS
), and not complete the program