E
E
Eugene2019-03-11 12:19:50
In contact with
Eugene, 2019-03-11 12:19:50

How to collect requests in execute and return a response?

The execute method allows you to send requests not one by one, but collect them in batches and send them every 50/334 ms. Let's say all application requests are collected in an array and 25 of them are selected in a 50 ms cycle, combined into code and sent to the server.
The question is, how does each function return its own response?
For example, there are three functions messages.send, users.get,
messages.getHistory. They are combined into an execute request and sent. The response is an array with the results. How to return the first result of sending a message, the second list of users, and the third message history?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2019-03-11
@sergiks

Collect responses in an array in the code of the execute procedure:

var result = [];

result.push( API.messages.send(...));
result.push( API.users.get(...));
result.push( API.messages.getHistory(...));

return result;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question