From 6809200911c6d0a9c7754b3c059e04378b1ca587 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Mon, 30 Jan 2023 08:17:33 +0100 Subject: [PATCH] ping command for two-way-delay --- index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 19894c7..f12ccba 100644 --- a/index.js +++ b/index.js @@ -73,6 +73,11 @@ app.post('/disconnect', (req, res) => { res.status(200).send(); }); +// User wants to measure ping +app.get('/ping', (req, res) => { + res.status(200).send(); +}); + // User wants to change name app.post('/nickname', (req, res) => { const { oldName, name, id } = req.body; @@ -87,7 +92,7 @@ app.post('/nickname', (req, res) => { for (const u of users) if (u.name === oldName && u.id === id) { if (consoleLogging) - console.log(`Renamed user with ID '${oldName}#${id}'.`); + console.log(`(Re-)named user with ID '${oldName}#${id}'.`); u.name = name; u.id = currentID; break; @@ -140,7 +145,7 @@ app.post('/message', (req, res) => { // Log message for debugging if (consoleLogging) - console.log(`User '${name}#${id}' sent message '${message}' to '${recipient}'.`); + console.log(`User '${name}#${id}' sent message '${message}'.`); // Confirm process res.status(200).send();