public function __construct(array $config = [])
{
$emulatorHost = getenv('PUBSUB_EMULATOR_HOST');
$baseUri = $this->getEmulatorBaseUri(self::BASE_URI, $emulatorHost);
if ($emulatorHost) {
$config['shouldSignRequest'] = false;
}
$config += ['serviceDefinitionPath' => __DIR__ . '/ServiceDefinition/pubsub-v1.json'];
$this->setRequestWrapper(new RequestWrapper($config));
$this->setRequestBuilder(new RequestBuilder($config['serviceDefinitionPath'], $baseUri, ['resources', 'projects']));
}
public function __construct() { // call parent constructor parent::__construct(); // create the asyncronous curl handler $this->handler = new CurlMultiHandler(); $httpClient = new Client(['handler' => HandlerStack::create($this->handler)]); // have the request wrapper call guzzle asyncronously $this->setRequestWrapper(new RequestWrapper(['scopes' => PubSubClient::FULL_CONTROL_SCOPE, 'httpHandler' => function ($request, $options = []) use($httpClient) { return $httpClient->sendAsync($request, $options); }, 'authHttpHandler' => HttpHandlerFactory::build()])); }