1<!DOCTYPE html> 2<html> 3<head> 4<title>test ws connection</title> 5<script type="text/javascript"> 6var protocol = location.protocol.replace('http', 'ws'); 7var url = protocol + '//' + location.host + '/echo-with-no-extension'; 8// Do connection test. 9var ws = new WebSocket(url); 10 11ws.onopen = function() 12{ 13 // Set document title to 'PASS'. The test observer catches this title changes 14 // to know the result. 15 document.title = 'PASS'; 16} 17 18ws.onclose = function() 19{ 20 // Set document title to 'FAIL'. 21 document.title = 'FAIL'; 22} 23 24</script> 25</head> 26</html> 27