Julien Reszka
Julien Reszka

Reputation: 1359

Trigger PubSub event in firebase emulator from CLI

According to this webpage it is possible to trigger a pubsub event from the CLI on an instance in the cloud https://firebase.google.com/docs/functions/pubsub-events

gcloud pubsub topics publish topic-name --message '{"name":"Xenia"}'

is it possible to trigger a pubsub even with the cli on the pubsub firebase emulator?

Upvotes: 2

Views: 240

Answers (1)

Mohamed E.
Mohamed E.

Reputation: 343

You can use the Pub/Sub REST API to publish a message to certain topic within the Pub/Sub Firestore Emulator, try this curl command:

curl -X POST http://127.0.0.1:8085/v1/projects/${PROJECT_ID}/topics/${TOPIC_ID}:publish \
     -H "Content-Type: application/json" \
     -d '{ "messages": [{ "data": "BASE64_DATA" }] }'

More information: https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/publish

Upvotes: 0

Related Questions