mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
sync message on recoonect on ui
This commit is contained in:
@@ -9,5 +9,6 @@ export abstract class ISignalRService {
|
||||
abstract join(): void;
|
||||
abstract getData<T>(): Observable<{ method: string; data: T }>;
|
||||
abstract getConnectionState(): Observable<boolean>;
|
||||
abstract onReconnect(): Observable<boolean>;
|
||||
abstract newConnection(): void;
|
||||
}
|
||||
@@ -3,8 +3,7 @@ import { BehaviorSubject, Observable, Subject, timer } from 'rxjs';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { SignalRConnection, SocketMessage } from './signalR';
|
||||
import { Plugins } from '@capacitor/core';
|
||||
import { z } from 'zod';
|
||||
import { filter, map, switchMap } from 'rxjs/operators';
|
||||
import { filter, map, skip, switchMap } from 'rxjs/operators';
|
||||
import { Result } from 'neverthrow';
|
||||
import { HubConnection } from '@microsoft/signalr';
|
||||
import { MessageOutPutDataDTO } from 'src/app/module/chat/data/dto/message/messageOutputDTO';
|
||||
@@ -127,9 +126,17 @@ export class SignalRService {
|
||||
return this.connection.join()
|
||||
}
|
||||
|
||||
// onReconnect() {
|
||||
// const connection = this.getConnectionState()
|
||||
// return connection.pipe(
|
||||
// skip(1) // Skip the first value
|
||||
// )
|
||||
// }
|
||||
|
||||
getData<T>() {
|
||||
return this.sendDataSubject.asObservable() as BehaviorSubject<{method: string, data: T}>
|
||||
}
|
||||
|
||||
public getConnectionState(): Observable<boolean> {
|
||||
return this.connectingSubject.asObservable();
|
||||
}
|
||||
|
||||
@@ -58,8 +58,6 @@ export class SignalRConnection {
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('Error while starting connection: ' + error);
|
||||
this.connectionStateSubject.next(false);
|
||||
|
||||
if(this.hasConnectOnce) {
|
||||
setTimeout(()=> {
|
||||
this.attempReconnect();
|
||||
|
||||
Reference in New Issue
Block a user