protected function _connect() { $connect_params = array('accept-version' => '1.0,1.1,1.2', 'heart-beat' => '0,0'); $accepted_headers = array('host', 'login', 'passcode'); foreach ($accepted_headers as $header) { if (isset($this->_connect_options[$header])) { $connect_params[$header] = $this->_connect_options[$header]; } } $connect_frame = new Frame(Frame::COMMAND_CONNECT, '', $connect_params); $this->_connection->write($connect_frame); if ($response = $this->_connection->readFrame()) { $this->_server_info = $response->getHeaders(); } else { throw new ConnectionException('No response from server.'); } }