Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (28 sloc) 872 Bytes
<html>
<head>
<!--
* Author: Gianluca Guarini
* Contact: gianluca.guarini@gmail.com
* Website: http://www.gianlucaguarini.com/
* Twitter: @gianlucaguarini
-->
<title>Push notification server</title>
</head>
<body>
<time></time>
<div id="container">Try to change your xml data to update this content</div>
<script src="socket.io/socket.io.js"></script>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script>
// creating a new websocket
var socket = io.connect('http://localhost:8000');
// on every message recived we print the new datas inside the #container div
socket.on('notification', function (data) {
// convert the json string into a valid javascript object
var _data = JSON.parse(data);
$('#container').html(_data.test.sample);
$('time').html('Last Update:' + new Date());
});
</script>
</body>
</html>