Commit 930fc129 authored by Raphaël Jakse's avatar Raphaël Jakse
Browse files

fix first WebSocket connection

parent 85b0bd04
......@@ -446,9 +446,12 @@ function countTiles(rack) {
return count;
}
function joinGame(gameNumber) {
function joinGame(gameNumber, message) {
if (!gameNumber) {
gameNumber = newGameId();
if (message) {
message.gameNumber = gameNumber;
}
}
const game = games[gameNumber] || (games[gameNumber] = new Game());
......@@ -719,7 +722,7 @@ function handleCommand(cmdNumber, message, response) {
function handleCommands(message, responseAndType) {
if (!message.cmds || !message.cmds.length) {
const {gameNumber, game} = joinGame(message.gameNumber);
const {gameNumber, game} = joinGame(message.gameNumber, message);
writeMessage(responseAndType,
JSON.stringify({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment