Hi,
So I was trying to wrap my head around the question that do producers or consumers be disconnected/closed for whatever reasons even if the concerned transport is connected ?
Looking into observer events we have,
Now in Producer.ts and Consumers.ts in mediasoup-client and same for the mediasoup server side,
I could see these events emitted on either close() or transportClosed() for producers/consumers, which we already have control over or related events (transpportclose) are already subscribed to. So I am assuming that there isn’t any other case where these observer events would be emitted. Hence no way to know for an abrupt closure using observer events.
I am trying to figure out if
Producers/Consumers will be closed without any events emitted (like an exception or failure) with the transport still connected ?
If such a scenario is possible how would we possibly know that the producer/consumer is alive even with a ping/pong mechanism between client server to know the status of the concerned producer/consumer ?
No. Once a Producer/Consumer is created they will emit a “xxxxxclose” event if they are closed due to their parent Transport closure (or “produceclose” in Consumer in case its associated Producer is closed).
BTW observers ar eintended for 3rd party libraries that do NOT call mediasoup API methods. In your app core logic you should not use observers (in theory). If you call producer.close() you know that you are closing it so no need for an event telling you “hey you have closed this”. However the Producer observer will always emit “close” no matter how it was closed.
However the Producer observer will always emit “close” no matter how it was closed.
Will a producer/consumer be closed in any other circumstances even if their parent “transportclose” never occurs ( or “producerclose” never occurs in case of a consumer) ?
(trying to understand if the observer will emit close in such cases and be used to know produce/consumer closure).
By definition a Consumer is closed when its associated Producer is closed (for whatever reason). So when the Producer is closed, the Consumer will emit producerclose event and its observer will emit close.