Skip to content

Instantly share code, notes, and snippets.

@dristic
Created August 28, 2013 22:04
Show Gist options
  • Save dristic/6371910 to your computer and use it in GitHub Desktop.
Save dristic/6371910 to your computer and use it in GitHub Desktop.
PubNub basic publish
var pubnub = PUBNUB.init({
publish_key: 'demo',
subscribe_key: 'demo'
});
pubnub.subscribe({
channel: "myChannel",
callback: function (message) {
console.log("I got the message: " + message);
},
connect: function () {
pubnub.publish({
channel: "myChannel",
message: "Hello World!"
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment