@andreabiagini5/applicazioni-e-servizi-web-project
Version:
Project for Applicazioni e Servizi Web.
18 lines • 749 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.disconnect = void 0;
const socket_1 = require("./socket");
const matchmakingQueue_1 = require("../repositories/matchmakingQueue");
const matchmakingQueue_2 = require("../repositories/matchmakingQueue");
const disconnect = async (socket) => {
const username = socket.data.username;
if (username) {
console.log(`User ${username} disconnected`);
(0, socket_1.removePlayerSocket)(username);
const candidate = await (0, matchmakingQueue_1.getCandidate)(username);
if (candidate)
await (0, matchmakingQueue_2.removeCandidate)(candidate);
}
};
exports.disconnect = disconnect;
//# sourceMappingURL=disconnect.js.map