General purpose P2P API?

388 views
Skip to first unread message

Dan Fabulich

unread,
Jan 18, 2012, 9:33:24 PM1/18/12
to discuss...@googlegroups.com
I'm confused by the documentation for WebRTC, but it seems as though the WebRTC API is designed for P2P connections, but ONLY for video/voice connections.

Is it possible to transmit arbitrary strings/bytes using the PeerConnection API? Is it possible to build custom non-media apps (text chat clients, games) based on the P2P API?

If so, what should we pass to the PeerConnection.AddStream method? It takes a boolean "True for video; false for voice".

Randell Jesup

unread,
Jan 18, 2012, 10:31:28 PM1/18/12
to discuss...@googlegroups.com
On 1/18/2012 9:33 PM, Dan Fabulich wrote:
> I'm confused by the documentation for WebRTC, but it seems as though the
> WebRTC API is designed for P2P connections, but ONLY for video/voice
> connections.
>
> Is it possible to transmit arbitrary strings/bytes using the
> PeerConnection API? Is it possible to build custom non-media apps (text
> chat clients, games) based on the P2P API?

Absolutely. Check out the discussions of the Data apis here and in the
public-webrtc W3C mailing list. It should be great for games.

The general plan is to have both unreliable and reliable channels
available. The primary proposal is to use SCTP/DTLS/UDP as the protocol
stack; SCTP should give us unreliable, reliable and partly-reliable
(limited retry time), and ordered or unordered for unreliable.

There's no plan to provide custom codecs for 'media' (SRTP) channels;
you'd need to use the data channels.

> If so, what should we pass to the PeerConnection.AddStream method? It
> takes a boolean "True for video; false for voice".

The Data apis are still in definition; the current W3C spec has an older
version which assumes a single data channel with no options.


--
Randell Jesup
randel...@jesup.org

Justin Uberti

unread,
Jan 18, 2012, 11:01:12 PM1/18/12
to discuss...@googlegroups.com
The current Chrome implementation does not support any data APIs.

Dan Fabulich

unread,
Jan 19, 2012, 12:07:59 AM1/19/12
to discuss...@googlegroups.com
Thanks. To clarify, does that mean that it's not currently possible to build a P2P text chat client in the Chrome dev channel implementation?

Justin Uberti

unread,
Jan 19, 2012, 12:14:57 AM1/19/12
to discuss...@googlegroups.com
Correct. Although, for text chat, you might as well use WebSockets.

Dan Fabulich

unread,
Jan 19, 2012, 12:40:45 AM1/19/12
to discuss...@googlegroups.com
WebSockets can't do P2P, can they?

Bob Wolff

unread,
Jan 19, 2012, 12:55:27 AM1/19/12
to discuss...@googlegroups.com

XMPP through the server for the lower bandwidth data.

Bob-  www.GoCast.it

Justin Uberti

unread,
Jan 19, 2012, 10:48:09 AM1/19/12
to discuss...@googlegroups.com
No, but for sending text, p2p doesn't really add much. You can just send the data over HTTP.

Ewoud van den Boom

unread,
Apr 7, 2012, 9:52:39 AM4/7/12
to discuss...@googlegroups.com
Personally I'm only interested in the WebRTC data API (do not need video or voice at this point in time).

WebRTC P2P vs WebSockets for data / text: are the following assumptions correct? 
  • I assume WebRTC to consume less server resources.
  • I assume WebRTC to have lower latency.
  • I assume WebRTC to have potentially more available bandwidth as it is not limited by the server bandwidth.
  • I assume WebRTC connections are potentially more reliable than WebSockets as disruption at the server (e.g. quick restart of the process) would not impact the connection.
I have not been able to find a working example of sending data P2P over WebRTC.

Thank you.

Randell Jesup

unread,
Apr 8, 2012, 1:16:04 PM4/8/12
to discuss...@googlegroups.com
On 4/7/2012 9:52 AM, Ewoud van den Boom wrote:
Personally I'm only interested in the WebRTC data API (do not need video or voice at this point in time).

WebRTC P2P vs WebSockets for data / text: are the following assumptions correct? 
  • I assume WebRTC to consume less server resources.

Typically yes.  (At most a use of a TURN server, which is basically a packet mirror with no SSL decode/encode on each transfer, and most connections won't require TURN.)


  • I assume WebRTC to have lower latency.

Yes, if it avoids a TURN server.  With TURN the latency will likely be similar (perhaps a little lower for TURN.)  Also, the congestion-control algorithm for data will likely be tuned for low-delay operation instead of normal TCP maximal throughput, which will help in the TURN case as well.


  • I assume WebRTC to have potentially more available bandwidth as it is not limited by the server bandwidth.

It can be higher p2p bandwidth if the server is overloaded, far away, or if the peers are on the same LAN or same access provider (cable company, etc).  In most cases a WebSocket server shouldn't be a limiting factor on bandwidth.


  • I assume WebRTC connections are potentially more reliable than WebSockets as disruption at the server (e.g. quick restart of the process) would not impact the connection.

That depends.  WebRTC connection should be able to handle (for example) local IP changes in the middle of use that WebSockets would require a reconnect to handle, though there will be a delay re-establishing WebRTC data on an IP change as well.  The reset of a signaling proxy though could interrupt a webrtc call.


I have not been able to find a working example of sending data P2P over WebRTC.

We expect to have working examples soon in FireFox development tests (this is not yet in nightly builds).

The API expected is shown in the current W3 draft spec.

-- 
Randell Jesup
randel...@jesup.org

Phil Holden

unread,
Apr 27, 2012, 4:24:32 PM4/27/12
to discuss-webrtc
I just finished writing an arcade game using web sockets. It sends
minimal information by using prediction. In terms of performance it
runs really well but bandwidth cost is the limiting factor. If I
hosted it on Amazon EC2 to generate £5 in advertising revenue would
cost £11 in bandwidth. I have a great game but cannot launch it. With
P2P bandwidth cost should drop to zero. I would really love to see a
simple text chat app written for web rtp as this would tell me all I
need to know for a network game. A text chat program is a great hello
world. I really struggle to understand the spec.

Justin Uberti

unread,
Apr 27, 2012, 4:58:04 PM4/27/12
to discuss...@googlegroups.com
Once the actual API exists in browsers, expect to see many examples. Hopefully that will occur sometime this summer.

Joran Greef

unread,
May 2, 2012, 5:00:35 AM5/2/12
to discuss...@googlegroups.com
Beg to differ. Sending text data over HTTP is a waste. HTTP headers alone waste 500 bytes per request even if you're just typing ":)". Then there's HTTP protocol parsing CPU, GC overhead etc. Also some people have gigabytes of text data they need to spread, and often it's to people on the same LAN as them. Really looking forward to the P2P data api and hope it gets top priority.

李一山

unread,
May 2, 2012, 5:17:47 AM5/2/12
to discuss...@googlegroups.com
I want to know how to apply chorme's api:  webkitPeerConnection00 to form a application???

2012/5/2 Joran Greef <jo...@ronomon.com>

Harout Bulbulian

unread,
Jun 5, 2012, 6:16:51 AM6/5/12
to discuss...@googlegroups.com
what is the new features to support this method? and what is the connection protocols can it use?
Reply all
Reply to author
Forward
0 new messages