K..
K..

Reputation: 4233

How to check if a RTCPeerConnection is working?

I got a RTCPeerConnection, when the connection is established I want to disconnect from the web-server.

How do I check for an established connection?

readyState was always undefined and onopen never fired.

Upvotes: 2

Views: 2611

Answers (2)

tomtheengineer
tomtheengineer

Reputation: 4277

readyState comes from an earlier version of the standard. You can now determine this from the PeerConnection.oniceconnectionstatechange callback and by querying the PeerConnection.iceConnectionState. The state value you're looking for is probably connected.

Upvotes: 5

Marin Sagovac
Marin Sagovac

Reputation: 3992

I'm not sure, is this for you?

if (typeof RTCPeerConnection == "undefined") {
  Abort("RTCPeerConnection is not supported/enabled in this browser, cannot test!");
}

or maybe set to null value to broke up a connection?

RTCPeerConnection = null;

Upvotes: 0

Related Questions