This commit is contained in:
Peter Maquiran
2022-03-03 22:57:33 +01:00
parent 3a81e6df4d
commit f5880fec2a
15 changed files with 877 additions and 801 deletions
+29 -4
View File
@@ -123,6 +123,30 @@ export class WsChatService {
});
}
readMessage(roomId) {
const requestId = uuidv4()
const message = {
"msg":"method",
"method":"readMessages",
"params": [roomId, []],
"id": requestId
}
this.ws.send({message, requestId})
return new Promise<Rooms>((resolve, reject) => {
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
if(message.id == requestId) { // same request send
resolve(message)
return true
}
}})
});
}
getUserOfRoom(roomId) {
const requestId = uuidv4()
@@ -174,6 +198,8 @@ export class WsChatService {
}]
}
console.log('send message to rocketchat ', message)
this.ws.send({message, requestId});
return new Promise((resolve, reject) => {
@@ -285,7 +311,7 @@ export class WsChatService {
});
}
joinRoom(){}
joinRoom() {}
deleteMessage(msgId) {
const requestId = uuidv4();
@@ -369,7 +395,7 @@ export class WsChatService {
}
subStreamNotifyRoom(roomId : string , event: 'typing' | 'deleteMessage', param: any) {
subStreamNotifyRoom(roomId : string , event: 'typing' | 'deleteMessage' | 'readMessage', param: any) {
const requestId = uuidv4()
@@ -496,7 +522,7 @@ export class WsChatService {
}
updateRoomEventss(roomId, collection:string, funx: Function, ) {
updateRoomEventss(roomId, collection:string, funx: Function, ) {
this.ws.registerCallback({
type:'Onmessage',
@@ -515,7 +541,6 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
})
}
streamRoomMessages(roomId : string) {
const requestId = uuidv4()