Longpoll: Add wait parameter as in original VK

This commit is contained in:
veselcraft 2022-09-19 17:13:37 +03:00
parent 697a365205
commit b38f4f2346
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E

View file

@ -96,6 +96,13 @@ final class MessengerPresenter extends OpenVKPresenter
$legacy = $this->queryParam("version") < 3; $legacy = $this->queryParam("version") < 3;
$time = intval($this->queryParam("wait"));
if($time > 60)
$time = 60;
elseif($time == 0)
$time = 25; // default
$this->signaler->listen(function($event, $eId) use ($id) { $this->signaler->listen(function($event, $eId) use ($id) {
exit(json_encode([ exit(json_encode([
"ts" => time(), "ts" => time(),
@ -103,7 +110,7 @@ final class MessengerPresenter extends OpenVKPresenter
$event->getVKAPISummary($id), $event->getVKAPISummary($id),
], ],
])); ]));
}, $id); }, $id, $time);
} }
function renderApiGetMessages(int $sel, int $lastMsg): void function renderApiGetMessages(int $sel, int $lastMsg): void