murat-dogan / node-datachannel

WebRTC For Node.js and Electron. libdatachannel node bindings.
Mozilla Public License 2.0
292 stars 56 forks source link

feat: accept preconfigured PeerConnection as polyfill arg #260

Open achingbrain opened 3 months ago

achingbrain commented 3 months ago

There are cases where we need to use methods on PeerConnection that are not available on RTCPeerConnection, but then we wish to pass the RTCPeerConnection on to other code for it to use in a polymorphic node/browser way.

Add an option to the polyfilled RTCPeerConnection to pass a preconfigured PeerConnection instance in, instead of always creating one.

murat-dogan commented 3 months ago

Thanks for the PR. But I can not see any reference from docs. https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/RTCPeerConnection

achingbrain commented 3 months ago

It's a non standard option, true.

It'll only appear as a valid option if you import the polyfill and use it directly.

If you use the bundled types from lib.dom.d.ts it'll not be available.

murat-dogan commented 3 months ago

As I understood this is a special case for your app. Since this part is polyfill I am not sure how to continue.