002.html (761B)
1 <!doctype html> 2 <title>WebSockets: server sends closing handshake</title> 3 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharnessreport.js></script> 5 <script src=../constants.sub.js></script> 6 <meta name="variant" content="?default"> 7 <meta name="variant" content="?wss"> 8 <meta name="variant" content="?wpt_flags=h2"> 9 <div id=log></div> 10 <script> 11 async_test(function(t){ 12 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo_exit'); 13 ws.onmessage = ws.onerror = t.unreached_func(); 14 ws.onopen = t.step_func(function(e) { 15 ws.send('Goodbye'); 16 }) 17 ws.onclose = t.step_func(function(e) { 18 assert_equals(e.wasClean, true, 'e.wasClean'); 19 ws.onclose = t.unreached_func(); 20 t.step_timeout(() => t.done(), 50); 21 }); 22 }); 23 </script>