From da6f44853e9cc6866ea1fe912eebcd4541e4c530 Mon Sep 17 00:00:00 2001 From: hyeonseokang Date: Fri, 1 Dec 2023 12:36:03 +0900 Subject: [PATCH] =?UTF-8?q?socket=20js=20=EA=B8=B4=EA=B8=89=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- socket.js | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/socket.js b/socket.js index f92b75e..19c524b 100644 --- a/socket.js +++ b/socket.js @@ -74,27 +74,28 @@ module.exports = (server) => { }); socket.on(Info.EVENT_MESSAGE.MATCH_START, async(deckIndex)=>{ - setTimeout(()=>{ - const userState = await UserState.findOne({ - where:{ - 'socketId':socket.id, - 'state':Info.userState.Join, - } - }); - - if(userState != null){ - if(userState.state != Info.userState.Join) - return; - - if(deckIndex == "") - deckIndex = 1; - socket.deckIndex = deckIndex; - console.log(socket.id, " 매칭 시작함"); - userState.state = Info.userState.Match; - await userState.save(); - socket.emit(Info.EVENT_MESSAGE.MATCH_START, ""); - } + await setTimeout(() => { + }, 2000); + const userState = await UserState.findOne({ + where:{ + 'socketId':socket.id, + 'state':Info.userState.Join, + } + }); + + if(userState != null){ + if(userState.state != Info.userState.Join) + return; + + if(deckIndex == "") + deckIndex = 1; + socket.deckIndex = deckIndex; + console.log(socket.id, " 매칭 시작함"); + userState.state = Info.userState.Match; + await userState.save(); + socket.emit(Info.EVENT_MESSAGE.MATCH_START, ""); + } }); socket.on(Info.EVENT_MESSAGE.MATCH_CANCEL, async ()=>{ const userState = await UserState.findOne({