Exemple #1
0
 public function clientSend(array $data)
 {
     if (!empty($this->client) && $this->client->getState() == WebSocketClient::STATE_CONNECTED) {
         $this->client->send(json_encode(array_merge(['id' => $this->client_incremental++], $data)));
         return true;
     }
     return false;
 }
Exemple #2
0
 public function clientSendPing()
 {
     if (!empty($this->client) && $this->client->getState() == WebSocketClient::STATE_CONNECTED) {
         $this->client->sendFrame(WebSocketFrame::create(WebSocketOpcode::PingFrame));
         return true;
     }
     return false;
 }