123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import { BehaviorSubject, Observable, Subject, interval } from "rxjs";
- import { BufferService } from "../services/buffer.service";
- import { ConnectionState } from "../interfaces/general.interface";
- // let obs1 = new Subject<any>
- let obs1 = new Subject<any>;
- interval(1000).subscribe(
- {
- next:(msg)=>{
- obs1.next(msg)
- }
- }
- );
- let initialReport = { status: 'DIRECT_PUBLISH' }
- let reportSubject: BehaviorSubject<any> = new BehaviorSubject(initialReport)
- let retransmission = new BufferService(obs1, reportSubject, 'mongo')
- let result: Observable<any> = retransmission.getMessages()
- result.subscribe(e => console.log(e))
- let publishBUFFER: ConnectionState = {
- status: `BUFFER`
- }
- let publishDIRECT_PUBLISH: ConnectionState = {
- status: `DIRECT_PUBLISH`
- }
- setTimeout(()=>{
- reportSubject.next(publishBUFFER);
- },5000)
- setTimeout(()=>{
- reportSubject.next(publishDIRECT_PUBLISH);
- },10000)
- // let initialReport = { status: 'BUFFER' }
- // let reportSubject: BehaviorSubject<any> = new BehaviorSubject(initialReport)
- // let retransmission = new BufferService(obs1, reportSubject, 'mongo', 5)
- // retransmission.getMessages().subscribe(e => console.log(e))
|