Answer the question
In order to leave comments, you need to log in
Why does LongPoll not work in VK API?
When trying to get message updates via Long Poll, an error occurs in the console that says a syntax error
The code itself:
//I call the method
vk.method("messages.getLongPollServer", {}, function(data){
let LongPoll = data.response //Save the key, server and ts
console.log(data) //Log them to the console
$.ajax({
url: "https://"+LongPoll.server+"?act=a_check&key="+LongPoll.key+"&ts ="+LongPoll.ts+"&wait=25", //Get data
method: "GET",
dataType: "JSONP",
success: function(resp){
console.log(resp); //Log received data to console
}
});
});
Answer the question
In order to leave comments, you need to log in
in browser JS you won't be able to use LongPoll due to Same Origin Policy
you need to use Node.JS
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question