Skip to content

Instantly share code, notes, and snippets.

@shyampurk
Created February 19, 2018 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shyampurk/ebda6c55def98934e525313f0fa4a480 to your computer and use it in GitHub Desktop.
Save shyampurk/ebda6c55def98934e525313f0fa4a480 to your computer and use it in GitHub Desktop.
Event Customer Feedback Subscribe
function pub_subscribe(){
pubnub.subscribe({
channel : channel_output,
message : function(m){
console.log(m);
message_listing(m);
},
error : function (error) {
console.log(JSON.stringify(error));
}
});
};
function message_listing(m){
if(m.feedbackClass == "suggestion"){
document.getElementById('responseClass').innerHTML = m.feedbackClass;
sCount ++;
document.getElementById('SuggestionCount').innerHTML = sCount;
}
else if (m.feedbackClass == "complaint"){
document.getElementById('responseClass').innerHTML = m.feedbackClass;
cCount ++;
document.getElementById('ComplaintCount').innerHTML = cCount;
}
else{
console.log("Invalid message");
console.log("Received message from block : ",m);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment