Skip to content

Instantly share code, notes, and snippets.

@eminetto
Created July 19, 2011 17:51
Show Gist options
  • Save eminetto/1093252 to your computer and use it in GitHub Desktop.
Save eminetto/1093252 to your computer and use it in GitHub Desktop.
sub.html
<html>
<head>
<title>Notifications</title>
</head>
<body>
<center><h2>Notifications</h2></center>
<div id="notification"></div>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load jQuery
google.load("jquery", "1.6");
</script>
<script src='http://pubsub.io/pubsub.io.js'></script>
<script>
var pubsub = pubsubio.connect('localhost:9999');
//assina o hub e filtra para buscar somente as mensagens de nome=events para o user=eminetto
pubsub.subscribe({name: 'events', user: 'eminetto'}, function(doc) {
$('#notification').prepend('<a href="' + doc.detail + '">' + doc.title + '</a><br>');
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment