Commit b6adc0b9 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Rename Connection to Stream in the JS code.

parent 675035ab
...@@ -34,7 +34,7 @@ function randomid() { ...@@ -34,7 +34,7 @@ function randomid() {
return toHex(a); return toHex(a);
} }
function Connection(id, pc) { function Stream(id, pc) {
this.id = id; this.id = id;
this.kind = null; this.kind = null;
this.label = null; this.label = null;
...@@ -47,11 +47,11 @@ function Connection(id, pc) { ...@@ -47,11 +47,11 @@ function Connection(id, pc) {
this.stats = {}; this.stats = {};
} }
Connection.prototype.setInterval = function(f, t) { Stream.prototype.setInterval = function(f, t) {
this.timers.push(setInterval(f, t)); this.timers.push(setInterval(f, t));
}; };
Connection.prototype.close = function(sendit) { Stream.prototype.close = function(sendit) {
while(this.timers.length > 0) while(this.timers.length > 0)
clearInterval(this.timers.pop()); clearInterval(this.timers.pop());
...@@ -492,7 +492,7 @@ function setMedia(id) { ...@@ -492,7 +492,7 @@ function setMedia(id) {
mine = false; mine = false;
} }
if(!c) if(!c)
throw new Error('Unknown connection'); throw new Error('Unknown stream');
let peersdiv = document.getElementById('peers'); let peersdiv = document.getElementById('peers');
...@@ -750,7 +750,7 @@ async function gotOffer(id, labels, offer, renegotiate) { ...@@ -750,7 +750,7 @@ async function gotOffer(id, labels, offer, renegotiate) {
let pc = new RTCPeerConnection({ let pc = new RTCPeerConnection({
iceServers: iceServers, iceServers: iceServers,
}); });
c = new Connection(id, pc); c = new Stream(id, pc);
down[id] = c; down[id] = c;
c.pc.onicecandidate = function(e) { c.pc.onicecandidate = function(e) {
...@@ -861,7 +861,7 @@ function send(m) { ...@@ -861,7 +861,7 @@ function send(m) {
throw(new Error('Sending null message')); throw(new Error('Sending null message'));
if(socket.readyState !== socket.OPEN) { if(socket.readyState !== socket.OPEN) {
// send on a closed connection doesn't throw // send on a closed connection doesn't throw
throw(new Error('Connection is not open')); throw(new Error('Stream is not open'));
} }
return socket.send(JSON.stringify(m)); return socket.send(JSON.stringify(m));
} }
...@@ -1205,7 +1205,7 @@ async function newUpStream(id) { ...@@ -1205,7 +1205,7 @@ async function newUpStream(id) {
if(up[id]) { if(up[id]) {
up[id].close(false); up[id].close(false);
} }
up[id] = new Connection(id, pc); up[id] = new Stream(id, pc);
pc.onnegotiationneeded = async e => { pc.onnegotiationneeded = async e => {
try { try {
...@@ -1246,7 +1246,7 @@ async function newUpStream(id) { ...@@ -1246,7 +1246,7 @@ async function newUpStream(id) {
async function negotiate(id, restartIce) { async function negotiate(id, restartIce) {
let c = up[id]; let c = up[id];
if(!c) if(!c)
throw new Error('unknown connection'); throw new Error('unknown stream');
if(typeof(c.pc.getTransceivers) !== 'function') if(typeof(c.pc.getTransceivers) !== 'function')
throw new Error('Browser too old, please upgrade'); throw new Error('Browser too old, please upgrade');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment