@google-cloud/pubsub

The default export of the @google-cloud/pubsub package is the PubSub class.

See PubSub and ClientConfig for client methods and configuration options.

Source:
Examples

Install the client library with npm:

npm install @google-cloud/pubsub

Import the client library

const {PubSub} = require('@google-cloud/pubsub');

Create a client that uses Application Default Credentials (ADC):

const pubsub = new PubSub();

Create a client with explicit credentials:

const pubsub = new PubSub({
  projectId: 'your-project-id',
  keyFilename: '/path/to/keyfile.json'
});

include:samples/quickstart.js

region_tag:pubsub_quickstart_create_topic
Full quickstart example:

Members

(static) v1 :object

Properties:
Name Type Description
PublisherClient constructor

Reference to v1.PublisherClient.

SubscriberClient constructor

Reference to v1.SubscriberClient.

Source:
See: