ping command for two-way-delay

This commit is contained in:
Baipyrus 2023-01-30 08:17:33 +01:00
parent 053818231a
commit 6809200911

View File

@ -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();