diff --git a/src/app/services/chat/ws-chat.service.ts b/src/app/services/chat/ws-chat.service.ts index b949d2435..6de1931b8 100644 --- a/src/app/services/chat/ws-chat.service.ts +++ b/src/app/services/chat/ws-chat.service.ts @@ -12,10 +12,12 @@ import { chatHistory, Rooms } from 'src/app/models/chatMethod'; export class WsChatService { isLogin = false; + loginResponse = {} constructor() {} connect() { + if(this.ws.connected == true) { return false } this.ws.connect(); @@ -41,6 +43,9 @@ export class WsChatService { } login() { + + if(this.isLogin == true) { return new Promise((resolve, reject)=>{ resolve(this.loginResponse) }) } + const requestId = uuidv4() const message = { @@ -66,6 +71,7 @@ export class WsChatService { if(message.result.token) { this.isLogin = true + this.loginResponse = message console.log('wsMsgQueue', this.wsMsgQueue) this.ws.wsMsgQueue()