Last active
August 29, 2015 13:56
-
-
Save stephenlb/9007884 to your computer and use it in GitHub Desktop.
Easy Get Started Guide with JavaScript Websockets.
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
<script src="http://cdn.pubnub.com/pubnub.min.js"></script> | |
<script> | |
// Initialize PubNub | |
var pubnub = PUBNUB.init({ | |
publish_key : "YOUR_PUB_KEY", // < -- YOUR PUBLISH KEY!!! ** | |
subscribe_key : "YOUR_SUB_KEY" // < -- YOUR SUBSCRIBE KEY!!! ** | |
}); | |
// Send a message | |
pubnub.publish({ channel : "chat", message : "hello!" }); | |
// Receive messages | |
pubnub.subscribe({ channel : "chat", message : my_function }); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment