/** * Close a connection with an HTTP response * @param Ratchet\ConnectionInterface * @param int HTTP status code */ protected function close(ConnectionInterface $conn, $code = 400) { $response = new Response($code, array('Sec-WebSocket-Version' => $this->versioner->getSupportedVersionString(), 'X-Powered-By' => \Ratchet\VERSION)); $conn->send((string) $response); $conn->close(); }