mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
add popup message
This commit is contained in:
@@ -74,13 +74,14 @@ export class ChatSystemService {
|
||||
* when the connection is lost the subscribe is also lost, so we have to subscribe again when reconnection is establish.
|
||||
*/
|
||||
|
||||
await this.chatService.refreshtoken();
|
||||
await this.getUser();
|
||||
this.RochetChatConnectorService.setStatus('online')
|
||||
await this.getAllRooms();
|
||||
this.subscribeToRoom();
|
||||
//
|
||||
this.getUserStatus();
|
||||
this.RochetChatConnectorService.setStatus('online')
|
||||
this.getUserStatus();
|
||||
await this.chatService.refreshtoken();
|
||||
this.getUser();
|
||||
this.getAllRooms();
|
||||
this.subscribeToRoom();
|
||||
//
|
||||
|
||||
|
||||
if(this.currentRoom) {
|
||||
this.currentRoom.loadHistory({forceUpdate: true})
|
||||
|
||||
@@ -19,7 +19,7 @@ export class RochetChatConnectorService {
|
||||
}
|
||||
|
||||
reConnect() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
connect() {
|
||||
@@ -67,7 +67,7 @@ export class RochetChatConnectorService {
|
||||
}
|
||||
|
||||
const requestId = uuidv4()
|
||||
//
|
||||
//
|
||||
const message = {
|
||||
msg: "method",
|
||||
method: "login",
|
||||
@@ -83,12 +83,12 @@ export class RochetChatConnectorService {
|
||||
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
//
|
||||
//
|
||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
||||
//
|
||||
//
|
||||
if(message.id == requestId ) { // same request send
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
if(message.result) {
|
||||
if(message.result.token) {
|
||||
this.isLogin = true
|
||||
@@ -99,11 +99,11 @@ export class RochetChatConnectorService {
|
||||
}, 10)
|
||||
|
||||
resolve(message)
|
||||
//
|
||||
//
|
||||
}
|
||||
} else {
|
||||
this.isLogin = false
|
||||
//
|
||||
//
|
||||
reject(message)
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ export class RochetChatConnectorService {
|
||||
|
||||
getRooms(roomOlder = 1480377601) {
|
||||
|
||||
|
||||
|
||||
//const requestId = uuidv4()
|
||||
const requestId = uuidv4()
|
||||
const message = {
|
||||
@@ -219,7 +219,7 @@ export class RochetChatConnectorService {
|
||||
}]
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
this.ws.send({message, requestId});
|
||||
|
||||
@@ -325,7 +325,7 @@ export class RochetChatConnectorService {
|
||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
||||
if(message.id == requestId ) { // same request send
|
||||
resolve(message)
|
||||
//
|
||||
//
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -548,7 +548,7 @@ export class RochetChatConnectorService {
|
||||
|
||||
return new Promise<chatHistory>((resolve, reject) => {
|
||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
||||
//
|
||||
//
|
||||
if(message.id == requestId ) { // same request send
|
||||
resolve(message)
|
||||
return true
|
||||
@@ -746,7 +746,7 @@ export class RochetChatConnectorService {
|
||||
registerCallback:(params: wsCallbacksParams) => {
|
||||
|
||||
let id = params.requestId || params.key || uuidv4()
|
||||
//
|
||||
//
|
||||
this.wsCallbacks[id] = params
|
||||
this.n++
|
||||
return id
|
||||
@@ -758,8 +758,13 @@ export class RochetChatConnectorService {
|
||||
this.socket.onmessage = this.ws.onmessage;
|
||||
this.socket.onclose = this.ws.onclose;
|
||||
this.socket.onerror = this.ws.onerror;
|
||||
|
||||
console.log(' === on open connection ===')
|
||||
},
|
||||
onopen: async ()=> {
|
||||
|
||||
console.log('===socket on connection open===')
|
||||
|
||||
this.ws.connected = true
|
||||
this.backgroundservice.online();
|
||||
|
||||
@@ -802,7 +807,7 @@ export class RochetChatConnectorService {
|
||||
send: ({message, requestId = uuidv4(), loginRequired = true}:send) => {
|
||||
|
||||
if (this.ws.connected == false || loginRequired == true && this.isLogin == false) { // save data to send when back online
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
this.wsMsgQueue[requestId] = {message, requestId, loginRequired}
|
||||
@@ -814,7 +819,7 @@ export class RochetChatConnectorService {
|
||||
},
|
||||
|
||||
onmessage: async (event: any)=> {
|
||||
|
||||
|
||||
this.backgroundservice.online();
|
||||
|
||||
const data = JSON.parse(event.data)
|
||||
@@ -837,6 +842,7 @@ export class RochetChatConnectorService {
|
||||
onclose: async (event: any)=> {
|
||||
this.ws.connected = false
|
||||
this.isLogin = false
|
||||
console.error('===close socket connection===')
|
||||
|
||||
this.connect()
|
||||
this.login()
|
||||
@@ -854,13 +860,14 @@ export class RochetChatConnectorService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
onerror: (event: any) => {
|
||||
|
||||
console.log(' ==== error ====')
|
||||
},
|
||||
disconnect:() => {
|
||||
console.log('==== desconnect ====')
|
||||
if(this.socket) {
|
||||
this.socket.onopen = (event: any) => {}
|
||||
this.socket.onmessage = (event: any) => {}
|
||||
|
||||
Reference in New Issue
Block a user