aboutsummaryrefslogtreecommitdiff
path: root/index.html
blob: 845744ba96aa03c0a0375f879a9618f064402fee (plain)
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
<html>
	<head>
		<script type="text/javascript">
			var webSocket = null;

			function openSocket(){
				setTimeout(function(){
					webSocket = new WebSocket("ws://localhost:8001/foo/bar");
					webSocket.onclose = openSocket;
					webSocket.onmessage = function(event){
						console.log(event.data);
					};
				}, 1000);
			}

			function init(){
				openSocket();
				setInterval(function(){
					webSocket.send("foo");
				}, 1000);
			}
		</script>
	</head>
	<body onload="init();">
	</body>
</html>