O
O
olezhenka2017-07-13 14:51:32
JavaScript
olezhenka, 2017-07-13 14:51:32

Why do VK callback API requests take a long time to arrive?

Each event (new message, new comment, new post) takes ~10 seconds, this has been stable for a week now.
I haven't been able to figure out why for a week now. I asked TP VK, but they are silent.
I write in node.js. I changed the version of the node 3 times already, removed nginx, now only one script is running on port 80. Completely deleted the server and did everything in a new way. My script for accepting requests:

var http = require("http");

http.createServer(function(req, res) {
        console.log(req, res); вот здесь консолятся запросы, которые приходят только через 10 сек
  if (req.method !== 'POST') return req.connection.destroy();
  var body = "";
  req.on('data', function(chunk) {
    body += chunk;
  });
  req.on('end', function() {
    console.log(body);
    try {
      body = JSON.parse(body);
    } catch (e) {
      body = null;
      return req.connection.destroy();
    }
    console.log(body);
    switch(body.type) {
      case 'confirmation':
      res.end('тут моя строка, которую надо вернуть');
      break;
      default:
      res.end('OK');
    }
  });
}).listen(80);

a regular script for connecting to the callback API.
in VKontakte:
in callback API>requests>sent - when I write a message, for example, it instantly appears here, but it arrives on my server after 10 seconds;
in callback API>requests>failed - errors do not appear here at all;
And it all started a week ago, before the same script worked fine for me and there were no such delays.
please help, at least, who knows, tell me what is the possible reason for the delay in events.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question