function sendChatPacket() { // send friend a hello message $textMessage = new TextChatPacket(); $textMessage->setFrom(G::$uid); $textMessage->setTo(G::$friendId); $textMessage->setText('hello, how are you?[ID:' . rand(1000, 9999) . ']'); G::$client->send(serializePacket($textMessage)); }
public function sendChatPacket() { // send friend a hello message $textMessage = new TextChatPacket(); $textMessage->setFrom($this->userId); $textMessage->setTo(Gbl::getRandomUserId()); $textMessage->setText('hello, how are you?中文[ID:' . rand(1000, 9999) . ']'); $this->send($this->serializePacket($textMessage)); }