split_packet_check.html 625 B

1234567891011121314151617181920212223242526272829
  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. // Do connection test.
  9. var ws = new WebSocket(url);
  10. ws.onopen = function()
  11. {
  12. // Close WebSocket connection once it is established.
  13. ws.close();
  14. }
  15. ws.onclose = function(event)
  16. {
  17. // Check wasClean, then set proper title.
  18. if (event.wasClean && event.code === 3004 && event.reason === 'split test')
  19. document.title = 'PASS';
  20. else
  21. document.title = 'FAIL';
  22. }
  23. </script>
  24. </head>
  25. </html>