Google\Cloud\PubSub\Connection\Grpc::__construct PHP Method

__construct() public method

public __construct ( array $config = [] )
$config array
    public function __construct(array $config = [])
    {
        $this->codec = new PhpArray(['publishTime' => function ($v) {
            return $this->formatTimestampFromApi($v);
        }]);
        $config['codec'] = $this->codec;
        $this->setRequestWrapper(new GrpcRequestWrapper($config));
        $grpcConfig = $this->getGaxConfig();
        $emulatorHost = getenv('PUBSUB_EMULATOR_HOST');
        $baseUri = $this->getEmulatorBaseUri(self::BASE_URI, $emulatorHost);
        if ($emulatorHost) {
            $grpcConfig += ['serviceAddress' => parse_url($baseUri, PHP_URL_HOST), 'port' => parse_url($baseUri, PHP_URL_PORT), 'sslCreds' => ChannelCredentials::createInsecure()];
        }
        $this->publisherClient = new PublisherClient($grpcConfig);
        $this->subscriberClient = new SubscriberClient($grpcConfig);
    }