예제 #1
0
 /**
  * @override
  */
 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 IoConnectionInterface $conn
  * @param int $code
  * @return null
  */
 protected function close(IoConnectionInterface $conn, $code = 400)
 {
     $response = new HttpResponse($code);
     $conn->send((string) $response);
     $conn->close();
 }
예제 #3
0
파일: WsServer.php 프로젝트: khelle/surume
 /**
  * Close a connection with an HTTP response.
  *
  * @param IoConnectionInterface $conn
  * @param int $code
  * @return null
  */
 protected function close(IoConnectionInterface $conn, $code = 400)
 {
     $response = new HttpResponse($code, ['Sec-WebSocket-Version' => $this->wsDriver->getVersionHeader()]);
     $conn->send((string) $response);
     $conn->close();
     unset($conn->WebSocket);
 }