diff --git a/src/app/services/chat/ws-chat-methods.service.ts b/src/app/services/chat/ws-chat-methods.service.ts index 0b2305848..89591ea77 100644 --- a/src/app/services/chat/ws-chat-methods.service.ts +++ b/src/app/services/chat/ws-chat-methods.service.ts @@ -35,9 +35,9 @@ export class WsChatMethodsService { async getAllRooms () { this.loadingWholeList = true - const rooms: any = await this.WsChatService.getRooms(); + const rooms = await this.WsChatService.getRooms(); - console.log("ROOMS" + JSON.stringify(rooms)) + // console.log("ROOMS" + JSON.stringify(rooms)) rooms.result.update.forEach((roomData: room) => { let room:RoomService; diff --git a/src/app/services/chat/ws-chat.service.ts b/src/app/services/chat/ws-chat.service.ts index b177ad975..8b9a7c881 100644 --- a/src/app/services/chat/ws-chat.service.ts +++ b/src/app/services/chat/ws-chat.service.ts @@ -4,6 +4,7 @@ import { wsCallbacksParams, msgQueue, send } from 'src/app/models/rochet-chat-cl import { deepFind } from 'src/plugin/deep' import { environment } from 'src/environments/environment'; import { SessionStore } from 'src/app/store/session.service'; +import { chatHistory, Rooms } from 'src/app/models/chatMethod'; @Injectable({ providedIn: 'root' @@ -93,7 +94,7 @@ export class WsChatService { this.ws.send({message, requestId}) - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { this.ws.registerCallback({type:'Onmessage', funx:(message)=>{ if(message.id == requestId) { // same request send resolve(message) @@ -103,7 +104,10 @@ export class WsChatService { }); } - logout() {} + logout() { + this.isLogin = false + this.ws.connected = false + } // send message to room send(roomId, msg) { @@ -159,7 +163,7 @@ export class WsChatService { this.ws.send({message, requestId}) - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { this.ws.registerCallback({type:'Onmessage', funx:(message)=>{ // console.log(message) if(message.id == requestId ) { // same request send @@ -352,6 +356,7 @@ export class WsChatService { }, onmessage:(event: any)=> { + if(this.ws.connected == false) { return true } const data = JSON.parse(event.data) for (const [key, value] of Object.entries(this.wsCallbacks)) {