1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>test ws split packet</title> 5 <script type="text/javascript"> 6 var protocol = location.protocol.replace('http', 'ws'); 7 var url = protocol + '//' + location.host + '/close-with-split-packet'; 8 9 // Do connection test. 10 var ws = new WebSocket(url); 11 12 ws.onopen = function() 13 { 14 // Close WebSocket connection once it is established. 15 ws.close(); 16 } 17 18 ws.onclose = function(event) 19 { 20 // Check wasClean, then set proper title. 21 if (event.wasClean && event.code === 3004 && event.reason === 'split test') 22 document.title = 'PASS'; 23 else 24 document.title = 'FAIL'; 25 } 26 27 </script> 28 </head> 29 </html> 30