I can use the following code to create a new peer connection object:
var peer = new RTCPeerConnection();
When this happens, chrome shows it as new connection object in chrome://webrtc-internals/
I would like to destroy this object later. How to do it? I tried
peer.close();
but this does not seem to do anything, since the peer variable is still of type RTCPeerConnection and I can still see it active in chrome://webrtc-internals/.
If I unset the variable, like
peer=false;
it still shows it in chrome://webrtc-internals/. Yet if I close the webpage then it immediately disappears from chrome://webrtc-internals/.
What is the proper way to free the RTCPeerConnection object? I am asking because if I do not free them, I am occasionally getting refusal from web browser to create new RTCPeerConnection because there are too many of them in use.