mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Improve login to rocket chat
This commit is contained in:
@@ -27,17 +27,13 @@ class _RocketChatClientService {
|
||||
|
||||
this.ws.send(connectMessage)
|
||||
|
||||
this.ws.registerCallback({type:'Onmessage',funx:(message: any)=>{
|
||||
this.ws.registerCallback({type:'Onmessage',funx:(message: any) => {
|
||||
|
||||
if(message.msg == "ping") {
|
||||
this.ws.send({msg:"pong"})
|
||||
if(this.hasPing == false) {
|
||||
// first ping
|
||||
firstPingFunx()
|
||||
|
||||
setTimeout(()=>{
|
||||
this.getRooms()
|
||||
}, 5000)
|
||||
this.hasPing = true
|
||||
}
|
||||
}
|
||||
@@ -68,11 +64,14 @@ class _RocketChatClientService {
|
||||
if(message.result.id == requestId) { // same request send
|
||||
if(message.result) {
|
||||
if(message.result.token) {
|
||||
this.isLogin = true
|
||||
resolve(message)
|
||||
} else {
|
||||
this.isLogin = false
|
||||
reject(message)
|
||||
}
|
||||
} else {
|
||||
this.isLogin = false
|
||||
reject(message)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user