detecting consumer closed/ track ended

Is there any way to detect on client that consumer was just closed on server? https://mediasoup.org/documentation/v3/mediasoup-client/api/#consumer-on-trackended - never firing.
consumer.track.addEventListener('ended' not working too.

Listen on server side for “transportclose” and “producerclose” in the Consumer and notify the client. This is explained in the doc.

So, without pubsub system it’s imposible?

Well, you’ve seen that “trackended” is not emitted, right? We cannot do magic.

Track was stopped on publisher’s side, then producer and it’s consumer were closed on server. Why it’s not emmiting?

Ask browser vendors and those who make the WebRTC specification. I won’t use this forum as a generic WebRTC forum.