public function connect() : void
	{
		if (is_resource($this->connection)) {
			$this->logger->info('Connection already opened.');
			return;
		}

		$this->logger->info('Opening new connection.');

		$request = $this->oauth->getOauthRequest(
			$this->getParams(),
			$this->httpMethod,
			self::BASE_URL,
			$this->endpoint
		);

		$this->connection = fsockopen('ssl://stream.twitter.com', 443);
		stream_set_blocking($this->connection, true);
		$this->write($request);

		$response = [];
		while (!$this->eof()) {
			$line = trim((string)$this->readLine());
			if (empty($line)) {
				break;
			}

			$response[] = $line;
		}

		$this->checkResponseStatusCode($response[0]);

		$this->logger->info('Connection successful.', $response);
	}
public function connect() : void
	{
		if (is_resource($this->connection)) {
			$this->logger->info('Connection already opened.');
			return;
		}

		$this->logger->info('Opening new connection.');

		$request = $this->oauth->getOauthRequest(
			$this->getParams(),
			$this->httpMethod,
			self::BASE_URL,
			$this->endpoint
		);

		$this->connection = fsockopen('ssl://stream.twitter.com', 443);
		stream_set_blocking($this->connection, true);
		$this->write($request);

		$response = [];
		while (!$this->eof()) {
			$line = trim((string)$this->readLine());
			if (empty($line)) {
				break;
			}

			$response[] = $line;
		}

		$this->checkResponseStatusCode($response[0]);

		$this->logger->info('Connection successful.', $response);
	}
public function connect ( ) : void { if ( is_resource ( $ this -> connection ) ) { $ this -> logger -> info ( 'Connection already opened.' ) ; return ; } $ this -> logger -> info ( 'Opening new connection.' ) ; $ request = $ this -> oauth -> getOauthRequest ( $ this -> getParams ( ) , $ this -> httpMethod , self :: BASE_URL , $ this -> endpoint ) ; $ this -> connection = fsockopen ( 'ssl://stream.twitter.com' , 443 ) ; stream_set_blocking ( $ this -> connection , true ) ; $ this -> write ( $ request ) ; $ response = [ ] ; while ( ! $ this -> eof ( ) ) { $ line = trim ( ( string ) $ this -> readLine ( ) ) ; if ( empty ( $ line ) ) { break ; } $ response [ ] = $ line ; } $ this -> checkResponseStatusCode ( $ response [ 0 ] ) ; $ this -> logger -> info ( 'Connection successful.' , $ response ) ; }
Opens a connection to the Twitter Streaming API.
Opens a connection to the Twitter Streaming API .