Created
February 19, 2018 04:58
-
-
Save shyampurk/ebda6c55def98934e525313f0fa4a480 to your computer and use it in GitHub Desktop.
Event Customer Feedback Subscribe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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