Ensure session is available for disconnect

This commit is contained in:
Mitchell McCaffrey 2021-04-23 11:47:08 +10:00
parent f078fb687e
commit b2ed5d2f6b

View File

@ -111,7 +111,7 @@ class Session extends EventEmitter {
}
disconnect() {
this.socket.disconnect();
this.socket?.disconnect();
}
/**
@ -198,7 +198,12 @@ class Session extends EventEmitter {
this._gameId = gameId;
this._password = password;
this.socket.emit("join_game", gameId, password, process.env.REACT_APP_VERSION);
this.socket.emit(
"join_game",
gameId,
password,
process.env.REACT_APP_VERSION
);
this.emit("status", "joining");
}