remove method to infra added to message repository

This commit is contained in:
Peter Maquiran
2024-08-27 16:04:29 +01:00
parent 7800b65cba
commit 6c0a15fb7c
5 changed files with 34 additions and 57 deletions
@@ -28,7 +28,7 @@ export class SignalRService {
this.deadConnectionBackGround = new Subject()
this.deadConnectionBackGround.pipe(
switchMap(() => timer(150000)),
switchMap(() => timer(150000)), // 2 minutes 30 seconds
).subscribe(() => {
this.newConnection()
})
@@ -82,40 +82,6 @@ export class SignalRService {
}, 2000)
})
}
}
getMessage() {
return this.getData().pipe(
filter((e) : e is SocketMessage<MessageOutPutDataDTO>=> e?.method == 'ReceiveMessage'
),
map((e)=> e.data)
)
}
getTyping() {
return this.getData().pipe(
filter((e) : e is SocketMessage<UserTypingDTO>=> e?.method == 'TypingMessage'
),
map((e)=> e.data)
)
}
getMessageDelete() {
return this.getData().pipe(
filter((e) : e is SocketMessage<MessageOutPutDataDTO>=> e?.method == 'DeleteMessage'
),
map((e)=> e.data)
)
}
getMessageUpdate() {
return this.getData().pipe(
filter((e) : e is SocketMessage<MessageOutPutDataDTO>=> e?.method == 'UpdateMessage'
),
map((e)=> e.data)
)
}
sendData<T>(input: ISignalRInput) {
@@ -126,13 +92,6 @@ 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}>
}
+7 -3
View File
@@ -60,10 +60,11 @@ export class SignalRConnection {
console.log('Error while starting connection: ' + error);
if(this.hasConnectOnce) {
setTimeout(()=> {
this.attempReconnect();
resolve(this.attempReconnect());
}, 2000)
} else {
resolve(err(false))
}
resolve(err(false))
});
hubConnection.onclose(() => {
@@ -85,7 +86,9 @@ export class SignalRConnection {
});
if(this.reconnect) {
this.attempReconnect();
resolve(this.attempReconnect());
} else {
resolve(err(false))
}
});
@@ -100,6 +103,7 @@ export class SignalRConnection {
this.reconnectSubject.next(true)
}
return attempConnection
}
public join() {