1
1
15x032432019-01-01 16:45:20
PHP
15x03243, 2019-01-01 16:45:20

How to make requests to Long Poll VK?

The other day I learned about the Long Poll API from VKontakte.
I decided to switch from the Call Back API to the Long Poll API, but I can’t understand: How should I make requests to the Long Poll API, or rather, how to make them constantly, because in order to track events in real time, you need to constantly receive new data, because we should not delay the response to the user.
How to implement all this?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max Payne, 2019-01-01
@KenKup

1. Get data to send a request in the messages.getLongPollServer method
2. Form a request as written here https://vk.com/dev/bots_longpoll .
3. Get the data
4. Start from step 2, replacing the ts parameter with the one sent by the server.
4.1 Handles errors that the Long Poll will constantly report - expired ts, Internal Server Error and others.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question