send() публичный Метод

Send data to the connection.
public send ( string $data )
$data string
Пример #1
0
 /**
  * @override
  * @inheritDoc
  */
 public function send($msg)
 {
     if (!$this->WebSocket->closing) {
         if (!$msg instanceof DataInterface) {
             $msg = new Frame($msg);
         }
         $this->connection->send($msg->getContents());
     }
     return $this;
 }
Пример #2
0
 /**
  * Close a connection with an HTTP response.
  *
  * @param NetworkConnectionInterface $conn
  * @param int $code
  * @return null
  */
 protected function close(NetworkConnectionInterface $conn, $code = 400)
 {
     $response = new HttpResponse($code);
     $conn->send($response);
     $conn->close();
 }
Пример #3
0
 /**
  * Close a connection with an HTTP response.
  *
  * @param NetworkConnectionInterface $conn
  * @param int $code
  * @return null
  */
 protected function close(NetworkConnectionInterface $conn, $code = 400)
 {
     $response = new HttpResponse($code, ['Sec-WebSocket-Version' => $this->wsDriver->getVersionHeader()]);
     $conn->send($response);
     $conn->close();
     unset($conn->WebSocket);
 }