-
-
Save rohinip/af88fba590836af022c5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<!-- Include the PubNub Library --> | |
<script src="https://cdn.pubnub.com/pubnub.min.js"></script> | |
<!-- Instantiate PubNub --> | |
<script type="text/javascript"> | |
var PUBNUB_demo = PUBNUB.init({ | |
publish_key: 'demo', | |
subscribe_key: 'demo' | |
}); | |
</script> |
This file contains hidden or 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
// Publish a simple message to the demo_tutorial channel | |
PUBNUB_demo.publish({ | |
channel: 'demo_tutorial', | |
message: 'Hello PubNub, love the JavaScript SDK!' | |
}); |
This file contains hidden or 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
//Subscribe to the demo_tutorial channel | |
PUBNUB_demo.subscribe({ | |
channel: 'demo_tutorial', | |
message: function(m){console.log(m)} | |
}); |
This file contains hidden or 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
//Subscribe to the zeblines channel for sample messages | |
PUBNUB_demo.subscribe({ | |
channel: 'zeblines', | |
message: function(m){console.log(m)} | |
}); |
This file contains hidden or 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
<html> | |
<head> | |
<title>Getting Started With PubNub</title> | |
</head> | |
<body> | |
<script src="https://cdn.pubnub.com/pubnub.min.js"></script> | |
<script charset="utf-8"> | |
(function(){ | |
var PUBNUB_demo = PUBNUB.init({ | |
publish_key: 'demo', | |
subscribe_key: 'demo' | |
}); | |
PUBNUB_demo.subscribe({ | |
channel: 'demo_tutorial', | |
message: function(m){console.log(m)}, | |
connect : publish | |
}); | |
function publish() { | |
PUBNUB_demo.publish({ | |
channel: 'demo_tutorial', | |
message: 'Hello PubNub, love the JavaScript SDK!' | |
}); | |
} | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment