-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.html
27 lines (25 loc) · 956 Bytes
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Duostack Socket.IO Demo</title>
<script src="/socket.io/socket.io.js"></script>
<script>
// Set up the socket with the hostname ('null' will use the same host as
// the page itself) and our configuration.
// We only have one config option, and it's only necessary because this is
// a demo app and we want socket.io to select a transport on each visit.
var config = { rememberTransport: false },
socket = new io.Socket(null, config);
socket.connect();
// each message will be a new time, so just insert it directly
socket.on('message', function(data){
document.getElementById('time').innerHTML = data;
});
</script>
</head>
<body>
<p>If a time updating once per second, then it works!</p>
<p>The current server time is: <span id="time"></span></p>
</body>
</html>