set user status

This commit is contained in:
Peter Maquiran
2022-01-13 11:24:14 +01:00
parent 0f3f0e60df
commit 63c7ff027c
2 changed files with 25 additions and 3 deletions
+2
View File
@@ -42,6 +42,7 @@ export class AuthService {
this.WsChatService.connect();
this.WsChatService.login().then((message) => {
console.log('rocket chat login successfully', message)
this.WsChatService.temporaryStatus('online')
}).catch((message)=>{
console.log('rocket chat login failed', message)
})
@@ -115,6 +116,7 @@ export class AuthService {
this.WsChatService.connect();
this.WsChatService.login().then((message) => {
console.log('rocket chat login successfully', message)
this.WsChatService.temporaryStatus('online')
}).catch((message)=>{
console.log('rocket chat login failed', message)
})
+23 -3
View File
@@ -170,6 +170,23 @@ export class WsChatService {
});
}
temporaryStatus(status: 'online' | 'busy' | 'away' | 'offline') {
const requestId = uuidv4()
const message = {
msg: "method",
method: `UserPresence:setDefaultStatus`,
id: requestId,
params: [ status ]
}
this.ws.send({message, requestId})
}
subscribeNotifyRoom(roomId : string) {
const requestId = uuidv4()
@@ -208,9 +225,12 @@ export class WsChatService {
type:'Onmessage',
funx:(message)=>{
if(message.msg =='result') {
if(message.result.msg) {
if(message.result.rid == roomId) {
funx(message)
console.log(message)
if(message.result) {
if(message.result.msg) {
if(message.result.rid == roomId) {
funx(message)
}
}
}
}