-
Notifications
You must be signed in to change notification settings - Fork 639
Closed
Labels
api: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.
Description
Feels like if I just want to publish the message "Hello World" I have a lot more to know that I probably should, right?
var gcloud = require(‘gcloud’)({projectId: ‘my-project’, keyFile: ‘key.json’});
var pubsub = gcloud.pubsub();
pubsub.createTopic(‘Test’, function(err, topic) {
console.log(‘Created topic’, topic);
topic.publish({data: ‘Hello World!’}, function(err, messageIds) {
console.log(‘Published message’, messageIds);
});
});Any chance we can simplify the string-only message?
var gcloud = require(‘gcloud’)({projectId: ‘my-project’, keyFile: ‘key.json’});
var pubsub = gcloud.pubsub();
pubsub.createTopic(‘Test’, function(err, topic) {
console.log(‘Created topic’, topic);
topic.publishString('Hello World!', function(err, messageId) {
console.log('Published message', messageId);
});
});Or even better, just detect if someone sent us a string only...
var gcloud = require(‘gcloud’)({projectId: ‘my-project’, keyFile: ‘key.json’});
var pubsub = gcloud.pubsub();
pubsub.createTopic(‘Test’, function(err, topic) {
console.log(‘Created topic’, topic);
topic.publish('Hello World!', function(err, messageId) {
console.log('Published message', messageId);
});
});Metadata
Metadata
Assignees
Labels
api: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.