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'; 8var ws = new WebSocket(url); 9 10ws.onopen = function() { 11 document.title = 'CONNECTED'; 12}; 13 14ws.onclose = function() { 15 document.title = 'CLOSED'; 16}; 17</script> 18</head> 19</html> 20