Re: [webrtc-pc] Let createOffer and createAnswer resolve with RTCSessionDescription instead of RTCSessionDescriptionInit (#922)

> - How is toJSON supposed to be used now?

No need. It was a workaround. You now have the object toJSON() would have returned https://github.com/w3c/webrtc-pc/pull/2969.

`toJSON` is a detail function in service of JSON.stringify(), not normally meant to be called directly.


> - How is returning a dictionary consistent with emitting a [candidate object in the iceevent](https://w3c.github.io/webrtc-pc/#rtcpeerconnectioniceevent)?

It is consistent with apps' desire to mutate the offer or answer returned while `pc.localDescription.sdp` and `sender.transport.iceTransport.getSelectedCandidatePair().remote.candidate` remain [immutable](https://jsfiddle.net/jib1/530c6dza/). https://github.com/w3c/webrtc-pc/issues/573

> I'll note that returning RTCSessionDescription has not been a problem for anyone for the last eight years despite Firefox and Safari not doing so. Most web developers who have been around for a while stopped trusting toJSON [after this issue](https://issues.chromium.org/issues/40409658)

What are they doing then?

-- 
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/922#issuecomment-2091421361 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 2 May 2024 19:43:52 UTC