/** * @override */ public function send($msg) { if (!$this->WebSocket->closing) { if (!$msg instanceof DataInterface) { $msg = new Frame($msg); } $this->connection->send($msg->getContents()); } return $this; }
/** * 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(); }
/** * 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); }