Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple JS Reappt client that attempts subscription to topics with different permissions
var diffusion = require('diffusion');
// Connect to Reappt with requester credentials
diffusion.connect({
host : 'approvingBoldDaVinci.us.reappt.io',
port : 443,
secure : true,
principal : 'requester',
credentials : 'retseuqer'
}).then(function(session) {
// Subscribe to the "open/cats" topic
var openSub = session.subscribe('open/cats').on({
subscribe : function(details, topic) {
console.log('Subscribed to topic: ' + topic);
},
update : function(value, topic) {
console.log(topic + ' updated with value: ' + value);
},
error : function(error) {
console.log(error);
}
});
// Subscribe to the "closed/cats" topic
var closedSub = session.subscribe('closed/cats').on({
subscribe : function(details, topic) {
console.log('Subscribed to topic: ' + topic);
},
update : function(value, topic) {
console.log(topic + ' updated with value: ' + value);
},
error : function(error) {
console.log(error);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.