Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation enhancement proposal #34

Open
sdaclin opened this issue Apr 22, 2021 · 0 comments
Open

Documentation enhancement proposal #34

sdaclin opened this issue Apr 22, 2021 · 0 comments

Comments

@sdaclin
Copy link

sdaclin commented Apr 22, 2021

Hello,

I may be wrong but it seems that a piece of doc is missing regarding the use of the client as a consummer.
Spoiler alert I'm definitely not familiar with Node :|
I had hard time finding where you were binding the socket and finall I found in confluence this doc, so maybe it's worh adding it in the Readme.md :

const app = require('express')();
const PubSub = require('appc-pubsub');
let pubsub = new PubSub({
    key: someHexaKey,
    secret: someSecret
});
 
// Make sure JSON body parsing is done first
app.use(require('body-parser').json());
 
// Wire up the pubsub route handler to enable pubsub.on
app.post('/webhook', pubsub.handleWebhook);
 
// Listen for platform events
pubsub.on('event:com.appcelerator.platform.*', function (data) {
    console.log('Platform event received:', JSON.stringify(data, null, 4));
});
 
// Listen for billing renewal events
pubsub.on('event:com.appcelerator.billing.renew', function (data) {
    console.log('Subscription renewal event received:', JSON.stringify(data, null, 4));
});
 
app.listen(8008);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant