mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
- add method get user from room in ws api
- Modified logout method
This commit is contained in:
@@ -119,6 +119,35 @@ export class WsChatService {
|
||||
});
|
||||
}
|
||||
|
||||
getUserOfRoom(roomId) {
|
||||
|
||||
const requestId = uuidv4()
|
||||
|
||||
const message = {
|
||||
"msg": "method",
|
||||
"method": "getUsersOfRoom",
|
||||
"id": requestId,
|
||||
"params": [
|
||||
roomId,
|
||||
false,
|
||||
{
|
||||
"limit": 100,
|
||||
"skip": 0
|
||||
} ]
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}})
|
||||
});
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.isLogin = false
|
||||
this.ws.connected = false
|
||||
@@ -360,7 +389,7 @@ export class WsChatService {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
loadHistory(roomId, limit: number = 50) {
|
||||
|
||||
@@ -593,7 +622,7 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
|
||||
},
|
||||
onopen:()=> {
|
||||
this.ws.connected = true
|
||||
|
||||
|
||||
console.log('================== welcome to socket server =====================')
|
||||
|
||||
this.ws.wsMsgQueue()
|
||||
@@ -602,13 +631,13 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
|
||||
for (const [key, value] of Object.entries(this.wsCallbacks)) {
|
||||
if(value.type== 'reConnect') {
|
||||
const dontRepeat = value.funx()
|
||||
|
||||
|
||||
if(dontRepeat) {
|
||||
delete this.wsCallbacks[key]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user