<!doctype html> | |
<html> | |
<head> | |
<title>Connect to a WebSocket server</title> | |
<script type="text/javascript"> | |
var protocol = location.protocol.replace('http', 'ws'); | |
var url = protocol + '//' + location.host + '/count-connection'; | |
// Do connection test. | |
var ws = new WebSocket(url); | |
ws.onmessage = function(e) { | |
document.title = (e.data === 'open: 1, closed: 1' ? 'PASS' : 'FAIL'); | |
} | |
ws.onclose = function() { | |
document.title = 'FAIL'; | |
}; | |
</script> | |
</head> | |
</html> |