0
0
Fork 0

Integrate socket io into the server

This commit is contained in:
Oliver-Akins 2023-02-19 20:45:12 -07:00
parent 2ddb286efe
commit dddb1068be
4 changed files with 84 additions and 2 deletions

View file

@ -38,6 +38,16 @@ const route: ServerRoute = {
data.incorrect = 0;
data.key = convertToKey(spaced);
// Tell the overlay(s) to start a new game
request.server.app.io.to(channel).emit(`state`, {
active: true,
current: data.current,
incorrect: {
current: data.incorrect,
max: config.game.max_incorrect,
},
})
return `${data.current} (incorrect: ${data.incorrect}/${config.game.max_incorrect})`;
},
};