Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Simple Example for Pubnub messagin
<!DOCTYPE html>
<!-- open up this same page in two instances of the brower that way you can see the message pop up in the other instances of the browser-->
<!-- make sure to add the jquery.js file to the same location as this file -->
<!-- Author: Fernando Zamora 9 October 2014 -->
<html lang="en">
<meta charset="utf-8" />
<script src="jquery.js" type="text/javascript"></script>
<!-- Include the PubNub Library -->
<script src="" type="text/javascript"></script>
<!-- Instantiate PubNub -->
<script type="text/javascript">
var user = "larry";
var PUBNUB_demo = PUBNUB.init({
publish_key: 'demo',
subscribe_key: 'demo'
<script type="text/javascript">
channel: 'demo_tutorial',
message: function(m){alert( + " says: " + m.text)}
<a class="confirmLink" href="#">Click here</a>
<!--this script place below the confirmLink so that binding will work -->
<script type="text/javascript">
$(".confirmLink").click(function(e) {
function confirmClick(){
// Publish a simple message to the demo_tutorial channel
channel: 'demo_tutorial',
message: {"text":"Hi!", "name":user}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment