Category : ping

I have checked the ping response time following code. But this value differ about 100ms to real value. How to check the correctly ping response time using javascript in client-side? $.ajax({ url: ‘https://jsfiddle.net/’, method: ‘HEAD’, start_time: new Date().getTime(), success: function(data) { alert(‘This request took ‘+(new Date().getTime() – this.start_time)+’ ms’); } }); Source: Ask Javascript..

Read more

I have an intranet app that periodically checks status of a set of printers by sending it a "Host Status" command. If status returned is "No Response" I display the printer with a red background that user can click and get some additional info. This additional info is the part I need help with. When ..

Read more

I am working in an web-application with ping test i some pages, but the page is very slow and crashes browser, i tried with PHP and Jquery, follow the code: <div id="test"> <script> $(document).ready(function(){ setInterval(function(){ $("#test").load(window.location.href + "#test" ); }, 3000); }); </script> <?php //Teste de ping em PHP exec(‘ping 192.168.0.1’,$available, $retorno); if ($retorno == ..

Read more

I have code that connects to an external WebSocket API, which looks like follows: const WebSocket = require(‘ws’) const ws = new WebSocket(‘wss://example.com/’) const connectExternalAPI() => { ws.onopen = () => { ws.send(JSON.stringify(‘example’: ‘message’)) } ws.onerror = (event) => { console.error(event) } ws.onmessage = (event) => { console.log(event.data) } ws.onclose = (event) => { console.error(event) ..

Read more