mirror of
https://github.com/openvk/openvk
synced 2024-11-14 02:59:12 +03:00
Longpool: Update format for use in modern clients
This commit is contained in:
parent
283d8c1c2d
commit
697a365205
1 changed files with 9 additions and 0 deletions
|
@ -27,14 +27,23 @@ class NewMessageEvent implements ILPEmitable
|
|||
if($peer === $userId)
|
||||
$peer = $msg->getRecipient()->getId();
|
||||
|
||||
/*
|
||||
* Source:
|
||||
* https://github.com/danyadev/longpoll-doc
|
||||
*/
|
||||
|
||||
return [
|
||||
4, # event type
|
||||
$msg->getId(), # messageId
|
||||
256, # checked for spam flag
|
||||
$peer, # TODO calculate peer correctly
|
||||
$msg->getSendTime()->timestamp(), # creation time in unix
|
||||
$msg->getText(), # text (formatted)
|
||||
[], # empty additional info
|
||||
[], # empty attachments
|
||||
$msg->getId() << 2, # id as random_id
|
||||
$peer, # conversation id
|
||||
0 # not edited yet
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue