Estimating connection packet loss with a datachannel to a server-based WebRTC client?

201 views
Skip to first unread message

Hugh Lomas

unread,
Apr 23, 2014, 2:06:57 PM4/23/14
to discuss...@googlegroups.com
I would like to measure/estimate the packet loss rate of a network connection from a browser, without any plugins or installations. 

I am not familiar with networking protocols or infrastructure beyond a superficial level, but it seems within the realm of possibility to set up a WebRTC client on a server and create an unreliable datachannel connection with a browser client, and use that to count missing messages, which over time can be extrapolated into a packet loss measurement. I can't think of a good way to do this with WebSockets because of the reliable transmission of TCP. I don't yet understand what RTP, SCTP, etc are, or how they impact things. 

Googling around for the last day has not presented itself with a simple way to accomplish setting up a server-based WebRTC peer that can be connected to a client. The closest I've found so far appears to be node-webrtc. I haven't tried setting up node-webrtc yet, the documentation is lacking, though it appears to be what I am looking for.

Anyway, is this feasible? Is there a more obvious solution that I am missing? Am I oblivious to some fundamental thing that makes this a stupid question?

Shachar

unread,
Apr 24, 2014, 9:10:25 AM4/24/14
to discuss...@googlegroups.com
Do you have to measure the packet loss from within a browser?
There are more suitable tools to just check network parameters including packet loss over a certain link.

Hugh Lomas

unread,
Apr 24, 2014, 2:59:31 PM4/24/14
to discuss...@googlegroups.com
Yes, the goal is to do it from a browser without plugins, extensions, or external installations, which means any built in OS level tools or similar would be out of reach. 

Hugh Lomas

unread,
Apr 30, 2014, 3:38:48 PM4/30/14
to discuss...@googlegroups.com
I am successfully running node-webrtc, and am able to send messages from my browser to the server running webrtc. I have set up a simple bit of code to increment a number every 1 second and send it:

    var i = 0;
    setInterval( function(){
        dataChannels['@control'].send(i++);
    },1000);


So every one second the browser peer is sending server peer a number, which the server is logging. 
The datachannel is created with the following options:

    {
        outOfOrderAllowed: true
      , maxRetransmitNum: 0
    } 


When I simulate packet loss on either end (using http://jagt.github.io/clumsy/manual.html or http://www.linuxfoundation.org/collaborate/workgroups/networking/netem), there is no interruption of the number stream, it remains monotonically increasing, never skipping a number. Even with 50% packet loss it "pauses" the flow for a couple of seconds at most, but eventually manages to catch up, and the numbers remain in order.

It appears to me that the outOfOrderAllowed and maxRetransmitNum are being completely ignored. Is there any way to ensure the connection is unreliable?

Hugh Lomas

unread,
Apr 30, 2014, 3:46:57 PM4/30/14
to discuss...@googlegroups.com
I also checked webrtc-internals, and found that createLocalDataChannel says reliable: true, despite the options (outOfOrderAllowed and maxRetransmitNum) used in peerConnection.createDataChannel as shown above. 

Vikas Marwaha

unread,
Apr 30, 2014, 3:49:25 PM4/30/14
to discuss...@googlegroups.com
Hi,

Try with ordered:false & maxRetransmits:0. I think you using incorrect dictionary member. See here.

/Vikas


--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hugh Lomas

unread,
Apr 30, 2014, 3:56:46 PM4/30/14
to discuss...@googlegroups.com
That worked perfectly, thank you! I was just cloning the chromium source to do some digging but you pointed me right to it. Thank you very much!

Shachar

unread,
May 4, 2014, 9:45:45 AM5/4/14
to discuss...@googlegroups.com
outOfOrderAllowed and maxRetransmitNum is deprecated, as vikas mentioned using ordered,maxRetransmits does the trick.


On Wednesday, April 23, 2014 9:06:57 PM UTC+3, Hugh Lomas wrote:

xiaofeng mi

unread,
May 8, 2014, 3:07:56 PM5/8/14
to discuss...@googlegroups.com
Hi Huge,

I'm working webrtc datachannel rencent days. I modified the sample peerconnection_client code, and my demo can work when
the two clients are in same wifi. But when the two clients are in different net work, it cann't create connection.

Do you know how to solve this problem?

Thanks very much.

在 2014年4月24日星期四UTC+8上午2时06分57秒,Hugh Lomas写道:

Hugh Lomas

unread,
May 8, 2014, 4:24:31 PM5/8/14
to discuss...@googlegroups.com
I do not know how to fix your issue, I am new to WebRTC myself. 

You would likely have more success by creating a focused post detailing your questions and what you have attempted so far, rather than randomly posting your questions as a reply to ten unrelated topics. That said, this resource may be valuable for your issue: http://www.html5rocks.com/en/tutorials/webrtc/infrastructure/#after-signaling-using-ice-to-cope-with-nats-and-firewalls

xiaofeng mi

unread,
May 8, 2014, 4:35:52 PM5/8/14
to discuss...@googlegroups.com
OK, thanks.

在 2014年5月9日星期五UTC+8上午4时24分31秒,Hugh Lomas写道:
Reply all
Reply to author
Forward
0 new messages