Transmission Events, SP:4
We would like to keep track of the success or failure of data transmission. We need this for usage analysis and for invoicing later on.
What to do?
- Add 4 observables to RccTransmissionService:
-
.successfulIncomingTransmission$ -
.failedIncomingTransmissions$ -
.successfulOutgoingTransmission$ -
.failedOutgoingTransmissions$
-
The point here is to enable tracking of these events separately. If you find another way to better organize (maybe just on observable emitting various types of events), go for it.
Up to discussion
Incoming
This observables concerning the incoming transmissions should emit somewhere at the end of RccTransmissionService.listen()
. That method will try to pick the appropriate transmission service and call .listen()
on it, which will return a promise; if it rejects let .failedIncomingTransmissions$ emit (unless it rejects with a UserCanceledError), if it resolves let .successfulIncomingTransmission$ emit.
Outgoing
Things get a bit more difficult for the outgoing transmissions:
RccTransmissionService.setup()
and RccTransmissionService.setupWithExistingMeta()
return an RccTransmission
. The RccTransmission object has a .start() method that will start the transmission and return a promise. If that promise rejects .failedOutgoingTransmissions$ should emit (unless it rejects with UserCanceledError), if it resolves let successfulOutgoingTransmission$ emit. The problem is, that the .start() method it called somewhere else in the code and kind of out of reach for RccTransmissionService.
Maybe RccTransmissionService.setup() and
RccTransmissionService.setupWithExistingMeta()` need to add a wrapper around the returned RccTransmission in order to intercept the .start() call and track the returned promise.