• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!doctype html>
2<html>
3<head>
4<title>Connect to a WebSocket server</title>
5<script type="text/javascript">
6var protocol = location.protocol.replace('http', 'ws');
7var url = protocol + '//' + location.host + '/count-connection';
8
9// Do connection test.
10var ws = new WebSocket(url);
11
12ws.onmessage = function(e) {
13    document.title = (e.data === 'open: 1, closed: 1' ? 'PASS' : 'FAIL');
14}
15
16ws.onclose = function() {
17    document.title = 'FAIL';
18};
19
20</script>
21</head>
22</html>
23