ad monitoring

This commit is contained in:
Peter Maquiran
2024-08-21 11:37:47 +01:00
parent d76f2e240e
commit 82c67b8976
5 changed files with 51 additions and 19 deletions
+23 -1
View File
@@ -1,5 +1,5 @@
import * as signalR from '@microsoft/signalr';
import { BehaviorSubject, Observable } from 'rxjs';
import { BehaviorSubject, Observable, race, timer } from 'rxjs';
import { ok, Result, err } from 'neverthrow';
import { SessionStore } from 'src/app/store/session.service';
import { filter, first } from 'rxjs/operators';
@@ -232,6 +232,28 @@ export class SignalRConnection {
resolve(ok(value));
});
// // Create an observable for the timeout (8 seconds)
// const timeout$ = timer(8000);
// // Create an observable for the message
// const message$ = this.messageUPdateSubject.pipe(
// filter((message: MessageOutPutDataDTO) => requestId === message?.requestId),
// first()
// );
// // Use race to choose whichever completes first (either the message or the timeout)
// race(message$, timeout$).subscribe({
// next: (value) => {
// if (typeof value === 'number') {
// // If the value is a number, it means the timeout fired
// reject(err('No response, timeout'));
// } else {
// resolve(ok(value));
// }
// },
// error: (error) => reject(err('Error: ' + error))
// });
} else {
this.sendLaterSubject.next({method: 'SendMessage', args: data})
return reject(err(false))