I have created a simple prototype in WebRTC that uses test STUN servers provided by Google:
var servers = [
"stun:stun.l.google.com:19302",
...
];
I ran two separate apps (without a local server - i.e. NodeJS).
I just opened the file directly via web browser.
It successfully created a RTCPeerConnection
and RTCDataChannel
objects.
However, onopen
handler in RTCDataChannel
was never triggered.
The readyState
of the data channel is always "connecting".
SAMPLE CODE:
window.localConnection = localConnection =
new RTCPeerConnection(configuration); // configuration.iceServer
localChannel = localConnection.createDataChannel('data');
localChannel.onopen = function () { // never triggered
var readyState = localChannel.readyState;
console.log('Local channel state is: ' + readyState);
}
QUESTIONS:
1. Do I need a server (like NodeJS) to have a readyState
set to "open"?
2. When would readyState
transition to "open" state?