|
@@ -1,6 +1,6 @@
|
|
import { MessageTransmissionBase } from "./msg.transmission.base";
|
|
import { MessageTransmissionBase } from "./msg.transmission.base";
|
|
import { EventMessage, FisMessage, MessageTransmitter as MessageTransmitterInterface, TransmitterProfile } from '../interface/transport.interface'
|
|
import { EventMessage, FisMessage, MessageTransmitter as MessageTransmitterInterface, TransmitterProfile } from '../interface/transport.interface'
|
|
-import { AdapterSet, ConnectionState, Event, Transport, TransportEvent } from "../interface/connector.interface";
|
|
|
|
|
|
+import { AdapterSet, ConnectionState, Event, Transport, TransportEvent, TransportMessage } from "../interface/connector.interface";
|
|
import { v4 as uuidv4 } from 'uuid'
|
|
import { v4 as uuidv4 } from 'uuid'
|
|
import { TransmitterConnectionAdapter } from "../connector/connector.transmitter";
|
|
import { TransmitterConnectionAdapter } from "../connector/connector.transmitter";
|
|
import { BehaviorSubject, filter, map, Observable, Subject } from "rxjs";
|
|
import { BehaviorSubject, filter, map, Observable, Subject } from "rxjs";
|
|
@@ -23,12 +23,13 @@ export class MessageTransmissionTransmitter extends MessageTransmissionBase impl
|
|
this.setUpAdapter(adapterSets)
|
|
this.setUpAdapter(adapterSets)
|
|
this.setUpRetransmission()
|
|
this.setUpRetransmission()
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// by the time this transmission set is instantiated, the connected client would've been online. Need ot manually signal retransmission to release buffer immediately
|
|
// by the time this transmission set is instantiated, the connected client would've been online. Need ot manually signal retransmission to release buffer immediately
|
|
setUpRetransmission(): void {
|
|
setUpRetransmission(): void {
|
|
let connectionStateEvent = new BehaviorSubject<'OFFLINE' | 'ONLINE'>('ONLINE')
|
|
let connectionStateEvent = new BehaviorSubject<'OFFLINE' | 'ONLINE'>('ONLINE')
|
|
this.event.pipe(
|
|
this.event.pipe(
|
|
filter(event => event.event == 'Client Disconnected' || event.event == 'Client Reconnected'),
|
|
filter(event => event.event == 'Client Disconnected' || event.event == 'Client Reconnected'),
|
|
|
|
+ filter(event => (event.data as EventMessage).clientId == this.transmitterProfile.id),
|
|
map(event => {
|
|
map(event => {
|
|
if (event.event == 'Client Disconnected') {
|
|
if (event.event == 'Client Disconnected') {
|
|
return 'OFFLINE'
|
|
return 'OFFLINE'
|
|
@@ -46,7 +47,7 @@ export class MessageTransmissionTransmitter extends MessageTransmissionBase impl
|
|
(this.adapterService as TransmitterConnectionAdapter).emit(message)
|
|
(this.adapterService as TransmitterConnectionAdapter).emit(message)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
setTransmitter(transmitterProfile: TransmitterProfile): void {
|
|
setTransmitter(transmitterProfile: TransmitterProfile): void {
|
|
this.transmitterProfile = transmitterProfile
|
|
this.transmitterProfile = transmitterProfile
|
|
}
|
|
}
|