diff --git a/src/app/services/chat/ws-chat-methods.service.ts b/src/app/services/chat/ws-chat-methods.service.ts index ebb3792a3..eca8ae55b 100644 --- a/src/app/services/chat/ws-chat-methods.service.ts +++ b/src/app/services/chat/ws-chat-methods.service.ts @@ -124,26 +124,13 @@ export class WsChatMethodsService { subscribeToRoom() { for (const id in this.dm) { - this.WsChatService.streamRoomMessages(id).then((subscription)=>{ - console.log('streamRoomMessages', subscription) - }) - - this.WsChatService.subStreamNotifyRoom(id, 'typing', false) - this.WsChatService.streamNotifyRoomDeleteMessage(id).then((subscription)=>{ - console.log('streamNotifyRoomDeleteMessage', subscription); - }) + this.defaultSubtribe(id) } for (const id in this.group) { - this.WsChatService.streamRoomMessages(id).then((subscription)=>{ - console.log('streamRoomMessages', subscription) - }) - - this.WsChatService.subStreamNotifyRoom(id, 'typing', false) - this.WsChatService.streamNotifyRoomDeleteMessage(id).then((subscription)=>{ - console.log('streamNotifyRoomDeleteMessage', subscription); - }) + this.defaultSubtribe(id) } + this.WsChatService.streamNotifyLogged().then((subscription=>{ console.log('streamRoomMessages', subscription) })) @@ -151,20 +138,8 @@ export class WsChatMethodsService { subscribeToRoomUpdate(id, roomData) { - this.WsChatService.streamRoomMessages(id).then((subscription)=> { - console.log('streamRoomMessages', subscription) - }) - this.WsChatService.streamRoomMessages(id).then((subscription) => { - console.log('streamRoomMessages', subscription) - }) - this.WsChatService.streamNotifyLogged().then((subscription=> { - console.log('streamRoomMessages', subscription) - })) - this.WsChatService.streamNotifyRoomDeleteMessage(id).then((subscription)=>{ - console.log('streamNotifyRoomDeleteMessage', subscription); - }) - - this.WsChatService.subStreamNotifyRoom(id, 'typing', false) + + this.defaultSubtribe(id) this.prepareRoom(roomData); @@ -172,6 +147,22 @@ export class WsChatMethodsService { } + + /** + * @deprecated things a room need to subscribe on + * @param id + */ + private defaultSubtribe(id) { + this.WsChatService.streamRoomMessages(id).then((subscription)=>{ + console.log('streamRoomMessages', subscription) + }) + + this.WsChatService.subStreamNotifyRoom(id, 'typing', false) + this.WsChatService.streamNotifyRoomDeleteMessage(id).then((subscription)=>{ + console.log('streamNotifyRoomDeleteMessage', subscription); + }) + } + prepareRoom(roomData) { let room:RoomService; @@ -214,6 +205,10 @@ export class WsChatMethodsService { } } + /** + * @description update user status + * @param id user ID + */ getUserStatus(id?:string) { this.WsChatService.getUserStatus((d) => {