continue working on exit from room

This commit is contained in:
tiago.kayaya
2022-01-26 09:19:54 +01:00
parent c6ec2abc1f
commit 58a32f45d4
7 changed files with 161 additions and 19 deletions
+5 -1
View File
@@ -89,6 +89,10 @@ export class RoomService {
this.WsChatService.send(this.id, msg)
}
leave(rid?) {
this.WsChatService.leaveRoom(this.id)
}
getMsgFromDBMobile() {
console.log('ALL MSG DBBB', this.id)
this.sqlservice.getAllChatMSG(this.id).then((msg: any = []) => {
@@ -159,7 +163,7 @@ export class RoomService {
})
}
// runs onces only
loadHistory(limit = 100) {
@@ -99,6 +99,18 @@ export class WsChatMethodsService {
}))
}
leaveRoom(id?) {
return this.WsChatService.leaveRoom(id);
}
hidingRoom(id?) {
return this.WsChatService.hidingRoom(id);
}
addRoomOwner(roomid, userId){
return this.WsChatService.addRoomOwner(roomid, userId);
}
getDmRoom(id): RoomService {
try {
return this.dm[id]
+74
View File
@@ -153,6 +153,80 @@ export class WsChatService {
});
}
leaveRoom(roomId) {
const requestId = uuidv4()
var message = {
msg: "method",
method: "leaveRoom",
id: requestId,
params: [
roomId,
]
}
this.ws.send({message, requestId});
return new Promise((resolve, reject) => {
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
if(message.id == requestId || deepFind(message,'result.id') == requestId) { // same request send
resolve(message)
return true
}
}})
});
}
addRoomOwner(roomId, userId) {
const requestId = uuidv4()
var message = {
msg: "method",
method: "addRoomOwner",
id: requestId,
params: [
roomId,
userId
]
}
this.ws.send({message, requestId});
return new Promise((resolve, reject) => {
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
if(message.id == requestId || deepFind(message,'result.id') == requestId) { // same request send
resolve(message)
return true
}
}})
});
}
hidingRoom(roomId){
const requestId = uuidv4()
var message = {
msg: "method",
method: "hideRoom",
id: requestId,
params: [roomId]
}
this.ws.send({message, requestId});
return new Promise((resolve, reject) => {
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
if(message.id == requestId || deepFind(message,'result.id') == requestId) { // same request send
resolve(message)
return true
}
}})
});
}
joinRoom(){}
deleteMessage() {}
createRoom() {}