W3C home > Mailing lists > Public > public-webrtc@w3.org > February 2014

Re: Panic between createOffer() and setLocalDescription()

From: cowwoc <cowwoc@bbs.darktech.org>
Date: Thu, 20 Feb 2014 13:52:39 -0500
Message-ID: <53064EF7.3080708@bbs.darktech.org>
To: public-webrtc@w3.org
Especially given the fact that the WebRTC API is *not* low-level.

I'd be fine with it either being low-level (made to be wrapped) or 
high-level (clean by design) but right now it's high-level and has a ... 
problematic ... design.

Gili

On 20/02/2014 1:36 PM, piranna@gmail.com wrote:
> Promises will help here, but good APIs are not in contraposition of
> languages failures. Merge this calls maybe it's a little bit of sugar
> syntaxis, but it's not a bad thing at all... But definitelly, I don't
> agree with the sentence about "WebRTC is designed to build wrapping
> libraries". Low level is ok, but should be easy to use "as is", if you
> are forced to use a library you are learning to use that library, not
> the APIs that offer the browser.
>
> 2014-02-20 18:32 GMT+01:00 Tim Panton new <thp@westhawk.co.uk>:
>> On 20 Feb 2014, at 11:32, piranna@gmail.com wrote:
>>
>> Callback hell from real code:
>>
>>
>> peerConnection.setRemoteDescription(offer, function()
>> {
>>   peerConnection.createAnswer(function(answer)
>>   {
>>     peerConnection.setLocalDescription(answer, function()
>>     {
>>
>>         // Send back answer SDP
>>
>>     },
>>     console.error);
>>   },
>>   console.error);
>> },
>> console.error);
>>
>>
>>
>> And there you are confusing language failings with a problem in the API.
>> The API is made to be wrapped - the moment we decided not to embed
>> signalling
>> we (implicitly) made it so almost every webRTC app would use a javascript
>> library
>> to provide the domain specific interface used by the web programmers.
>>
>> Although, that said promises may make that look prettier.
>>
>> http://taoofcode.net/promise-anti-patterns/
>>
>>
>> T.
>
>
Received on Thursday, 20 February 2014 18:53:34 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:38 UTC