Skip to content

Instantly share code, notes, and snippets.

@stephenlb
Last active August 29, 2015 13:56
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 stephenlb/9007884 to your computer and use it in GitHub Desktop.
Save stephenlb/9007884 to your computer and use it in GitHub Desktop.
Easy Get Started Guide with JavaScript Websockets.
<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