I have connected two users over a RTCdatachannel. This works, but I would like monitor the traffic generated by it, e.g 1Mbit/s. Is there a way to get this?
The motivation is that one user creates content and the other side mirrors this, kind of a remote support application. The use case requires the content (text, images, 3D models) to be updated very frequently (mainly the location), causing a traffic increase. When it reaches some set threshold, I would like to reduce the rate at which the application sends updates, but for that the application would need to know the currently consumed bandwidth.
I imagine I can write an interval that collects all the messages that were passed to the send function during one second and sum up the sizes, but maybe there is some built in way?