@google-cloud/pubsub
module
The default export of the @google-cloud/pubsub
package is the
PubSub class.
See PubSub and ClientConfig for client methods and configuration options.
Examples
<caption>Install the client library with <a
href="https://www.npmjs.com/">npm</a>:</caption> npm install --save
Import the client library
const {PubSub} = require('@google-cloud/pubsub');
<caption>Create a client that uses <a
href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application
Default Credentials (ADC)</a>:</caption> const pubsub = new PubSub();
<caption>Create a client with <a
href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit
credentials</a>:</caption> const pubsub = new PubSub({ projectId:
'your-project-id', keyFilename: '/path/to/keyfile.json'
});
Full quickstart example:
Property
v1
static
object
Properties
Parameter |
|
---|---|
PublisherClient |
constructor Reference to v1.PublisherClient. |
SubscriberClient |
constructor Reference to v1.SubscriberClient. |
- See also
- v1.PublisherClient
- v1.SubscriberClient