/** * @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; }
/** * 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(); }
/** * @override * @inheritDoc */ public function handleError(IoConnectionInterface $conn, $ex) { if (!$this->isBlocked($conn->getHost())) { $this->component->handleError($conn, $ex); } }
/** * 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); }