file_udpsocket_iframe.html (528B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test UDPSocket BFCache</title> 5 </head> 6 <body> 7 <script type="application/javascript"> 8 'use strict'; 9 window.addEventListener('load', function() { 10 let remotePort = parseInt(window.location.search.substring(1), 10); 11 let socket = new UDPSocket(); 12 socket.addEventListener('message', function () { 13 socket.send('fail', '127.0.0.1', remotePort); 14 }); 15 16 socket.opened.then(function() { 17 socket.send('ready', '127.0.0.1', remotePort); 18 }); 19 }, {once: true}); 20 </script> 21 </body> 22 </html>