1<script> 2 3var sock = new WebSocket("wss://localhost:8443/control", "protocolOne"); 4 5sock.onopen = function(event) { 6 // Close connection after 5 secs. 7 // setTimeout(function() { sock.close(); }, 5000); 8 9 sock.send("Here's some sample text"); 10} 11 12sock.onmessage = function(event) { 13 console.log(event.data); 14} 15 16</script> 17 18<h1>Test</h1> 19 20