PubSub constructor

PubSub(
  1. Client client,
  2. String project
)

Access Pub/Sub using an authenticated client.

The client is an authenticated HTTP client. This client must provide access to at least the scopes in PubSub.Scopes.

The project is the name of the Google Cloud project.

Returs an object providing access to Pub/Sub. The passed-in client will not be closed automatically. The caller is responsible for closing it.

Implementation

factory PubSub(http.Client client, String project) {
  var emulator = Platform.environment['PUBSUB_EMULATOR_HOST'];
  return emulator == null
      ? _PubSubImpl(client, project)
      : _PubSubImpl.rootUrl(client, project, 'http://$emulator/');
}