ping command for two-way-delay
This commit is contained in:
parent
053818231a
commit
6809200911
9
index.js
9
index.js
@ -73,6 +73,11 @@ app.post('/disconnect', (req, res) => {
|
|||||||
res.status(200).send();
|
res.status(200).send();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// User wants to measure ping
|
||||||
|
app.get('/ping', (req, res) => {
|
||||||
|
res.status(200).send();
|
||||||
|
});
|
||||||
|
|
||||||
// User wants to change name
|
// User wants to change name
|
||||||
app.post('/nickname', (req, res) => {
|
app.post('/nickname', (req, res) => {
|
||||||
const { oldName, name, id } = req.body;
|
const { oldName, name, id } = req.body;
|
||||||
@ -87,7 +92,7 @@ app.post('/nickname', (req, res) => {
|
|||||||
for (const u of users)
|
for (const u of users)
|
||||||
if (u.name === oldName && u.id === id) {
|
if (u.name === oldName && u.id === id) {
|
||||||
if (consoleLogging)
|
if (consoleLogging)
|
||||||
console.log(`Renamed user with ID '${oldName}#${id}'.`);
|
console.log(`(Re-)named user with ID '${oldName}#${id}'.`);
|
||||||
u.name = name;
|
u.name = name;
|
||||||
u.id = currentID;
|
u.id = currentID;
|
||||||
break;
|
break;
|
||||||
@ -140,7 +145,7 @@ app.post('/message', (req, res) => {
|
|||||||
|
|
||||||
// Log message for debugging
|
// Log message for debugging
|
||||||
if (consoleLogging)
|
if (consoleLogging)
|
||||||
console.log(`User '${name}#${id}' sent message '${message}' to '${recipient}'.`);
|
console.log(`User '${name}#${id}' sent message '${message}'.`);
|
||||||
|
|
||||||
// Confirm process
|
// Confirm process
|
||||||
res.status(200).send();
|
res.status(200).send();
|
||||||
|
Loading…
Reference in New Issue
Block a user