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

Re: Panic between createOffer() and setLocalDescription()

From: Tim Panton new <thp@westhawk.co.uk>
Date: Thu, 20 Feb 2014 17:32:28 +0000
Cc: Harald Alvestrand <harald@alvestrand.no>, public-webrtc <public-webrtc@w3.org>
Message-Id: <94DF234F-0892-4454-B55B-7B0D65E9F0F7@westhawk.co.uk>
To: piranna@gmail.com

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 17:33:00 UTC

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