예제 #1
0
 /**
  * @override
  * @inheritDoc
  */
 public function handleConnect(IoConnectionInterface $conn)
 {
     if ($this->isBlocked($conn->getHost())) {
         return $conn->close();
     }
     return $this->component->handleConnect($conn);
 }
예제 #2
0
 /**
  * @override
  */
 public function close($code = 1000)
 {
     if ($this->WebSocket->closing) {
         return;
     }
     if ($code instanceof DataInterface) {
         $this->send($code);
     } else {
         $this->send(new Frame(pack('n', $code), true, Frame::OP_CLOSE));
     }
     $this->connection->close();
     $this->WebSocket->closing = true;
 }
예제 #3
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();
 }
예제 #4
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);
 }