Answer the question
In order to leave comments, you need to log in
How to make a latancy request to google?
How to check ping from service to google (latancy request)? "/latency [GET] - returns the delay from the service to google.com" - this is how it is written in the TOR.
Here is an option, but it does not work ... I register through a regular button on html, on a live server.
<button onclick="latency()">TOK</button>
async function latency(req, res) {
try {
exec('ping google.com', { encoding: 'binary' }, (err, stdout, stderr) => {
if (err) {
throw err;
}
const convert = iconv.decode(stdout, 'cp866'); /// Для рекода на русский
res.status(200).json(`${convert.match(/Среднее.=.\d+/)[0]}мс`);
});
} catch (e) {
res.status(400).json({ message: e.message });
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question