Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 69d3f0caa9
Fetching contributors…

Cannot retrieve contributors at this time

35 lines (34 sloc) 0.945 kB
<html>
<head>
<title>Socket IO Demo</title>
<script src="/client_socket.io/socket.io.js"></script>
<script type="text/javascript">
var sock = null;
var ts = null;
var body_loaded = function () {
sock = new io.Socket();
// sock = new io.Socket(null, {
// port: 80
// ,
// ,transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-multipart', 'xhr-polling', 'jsonp-polling']
// , transports: ['websocket']
// , rememberTransport: false
// });
sock.on('message', handleMessage);
sock.connect();
ts = document.getElementById('timestamp');
};
var handleMessage = function (data) {
var obj = JSON.parse(data);
ts.textContent = obj.timestamp;
};
</script>
</head>
<body onload="body_loaded();">
<div>
<h2>Socket IO Demo</h2>
<label for="timestamp">Timestamp</label>
<span id="timestamp"></span>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.