Handling err/warns

I would like to add on top of my mediasoup server some logic to do handle errors correctly. For instance detect poor connections, frequent disconnects, incompatibility issues between client/server etc. Can anyone point me to some documentation to do that? The documentation is huge and need some guidance on where to look

My experience with doing something similar by calling transport getStats in an interval server side was a failure because the node process quickly escalated in CPU usage. I don’t recommend doing this kind of thing in the same node process.

Any other recommendation?

You can have a different architecture server-side, if you wanna use do that 100% server side.

The other way is using client-side to process the getStats results from mediasoup using the WS or HTTP.
You can also use client-side RTCRtpSender/getStats. Be aware that this dictionary is different in FF, Chrome and Safari so you might not have access to some data.

This is a difficult issue because if a participant video is slow it doesn’t mean you have a poor connection, it could be the participant upload, mediasoup server lag, geographic link lag for upload/download, …

Other than these comments I’m afraid I have no more knowledge to share :frowning: Would love to hear other people on this subject.

Too many topics together here.

  • WebRTC disconnections are better handled/monitored at client level by listening for the transport.on('connectionstatechange') event. When ‘disconnected’ happens it means temporary bad connection. It may reconnected automatically (‘connected’/‘completed’ is fired again).

  • “Incompatibility issues between client/server”: I don’t know what this means and this is not something related to mediasoup but to your app.

  • “Poor connection”: Too vague concept. For media senders you can listen to producer.on('score') events in mediasoup Producer.

1 Like

How about the observers? Any special one I should look into to detect unreliable connections and report back the exact problem in order to find an appropriate mitigation? Idea is to spot all kinds of problems and find some workarounds for them

It seems like you’re looking for a simple answer to a wide reaching topic. Even “unstable connection” can have many meanings - for example the transport connection state could be flapping, there could be packet loss on the connection, latency could be high, there could be lots of jitter, your signaling service could be timing out, the client encoder might downgrade quality because of network or CPU usage, etc.

I think your best bet is to dig deep into the documentation, and log some telemetry data (producer scores, stats from the client and server, connectionstatechange events, etc) while you do reproducible qualitative tests.

You might also want to look into simulcast, as trying to force more bits over a wire than it supports can be the cause of connection instability, and bandwidth estimation based layer changes can help you, there.

[ edit: sorry for the deletion above, I wanted to thread this post correctly ]

1 Like

I don’t understand the question. There are no stats involved in the Producer/Consumer score events.

Reordering my reply to the correct thread:

Hello, Can you please advise how would you do the inter-process node communication in this case? I prefer not having the mediasoup media process being affected by the media soup stats

I’ve already replied to that.