Skip to content

Instantly share code, notes, and snippets.

@arangates
Created September 24, 2016 10:36
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 arangates/9541b09ce1c2eff7eaa08c49848751b7 to your computer and use it in GitHub Desktop.
Save arangates/9541b09ce1c2eff7eaa08c49848751b7 to your computer and use it in GitHub Desktop.
pubnubsubscribredata
<!DOCTYPE html>
<html>
<head>
<title>sub</title>
<div id="subdat" ></div>
<script src="http://cdn.pubnub.com/pubnub-3.16.3.min.js"></script><script type="text/javascript">
var pubnub = PUBNUB({
subscribe_key: 'sub-c-598e4d8e-e9e4-11e4-91d3-0619f8945a4f', // always required
publish_key: 'pub-c-3588af66-9bbd-4984-b578-27f5877f17db' // only required if publishing
});
pubnub.subscribe({
channel : 'Kcteee',
message : function(m){
console.log(m)
document.getElementById("subdat").innerHTML=JSON.stringify(m);
},
error : function (error) {
// Handle error here
console.log(JSON.stringify(error));
}
});
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment