PubSub

Access the PubSub API Consumer. You can instantiate a PubSub.Client to subscribe to PubSub events. Please check PubSub.PubSubClientApiEvents for the full list of events that a PubSub.Client can subscribe to.

Example

The following example logs the messages sent to the "welcome" channel.

const pubSubClient = new PubSub.Client({
  project: '<project-id>',
  token: '<api-token>'
})

pubSubClient.on('message', m => console.log(m))

await pubSubClient.subscribe("welcome")

Classes

Interfaces