mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +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)
|
if($peer === $userId)
|
||||||
$peer = $msg->getRecipient()->getId();
|
$peer = $msg->getRecipient()->getId();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Source:
|
||||||
|
* https://github.com/danyadev/longpoll-doc
|
||||||
|
*/
|
||||||
|
|
||||||
return [
|
return [
|
||||||
4, # event type
|
4, # event type
|
||||||
|
$msg->getId(), # messageId
|
||||||
256, # checked for spam flag
|
256, # checked for spam flag
|
||||||
$peer, # TODO calculate peer correctly
|
$peer, # TODO calculate peer correctly
|
||||||
$msg->getSendTime()->timestamp(), # creation time in unix
|
$msg->getSendTime()->timestamp(), # creation time in unix
|
||||||
$msg->getText(), # text (formatted)
|
$msg->getText(), # text (formatted)
|
||||||
|
[], # empty additional info
|
||||||
[], # empty attachments
|
[], # empty attachments
|
||||||
$msg->getId() << 2, # id as random_id
|
$msg->getId() << 2, # id as random_id
|
||||||
|
$peer, # conversation id
|
||||||
|
0 # not edited yet
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue