|
@@ -13,7 +13,6 @@ function DataChannels(peerConnection, emitter) {
|
13
|
13
|
peerConnection.ondatachannel = this.onDataChannel.bind(this);
|
14
|
14
|
this.eventEmitter = emitter;
|
15
|
15
|
|
16
|
|
- this._lastNEndpoints = null;
|
17
|
16
|
this._dataChannels = [];
|
18
|
17
|
|
19
|
18
|
// Sample code for opening new data channel from Jitsi Meet to the bridge.
|
|
@@ -124,19 +123,17 @@ DataChannels.prototype.onDataChannel = function(event) {
|
124
|
123
|
newValue);
|
125
|
124
|
} else if (colibriClass === 'LastNEndpointsChangeEvent') {
|
126
|
125
|
// The new/latest list of last-n endpoint IDs.
|
127
|
|
-
|
128
|
|
- self._lastNEndpoints = obj.lastNEndpoints;
|
|
126
|
+ const lastNEndpoints = obj.lastNEndpoints;
|
129
|
127
|
|
130
|
128
|
// The list of endpoint IDs which are entering the list of
|
131
|
129
|
// last-n at this time i.e. were not in the old list of last-n
|
132
|
130
|
// endpoint IDs.
|
133
|
131
|
const endpointsEnteringLastN = obj.endpointsEnteringLastN;
|
134
|
132
|
|
135
|
|
- logger.info(
|
136
|
|
- 'Data channel new last-n event: ',
|
137
|
|
- self._lastNEndpoints, endpointsEnteringLastN, obj);
|
|
133
|
+ logger.info('Data channel new last-n event: ',
|
|
134
|
+ lastNEndpoints, endpointsEnteringLastN, obj);
|
138
|
135
|
self.eventEmitter.emit(RTCEvents.LASTN_ENDPOINT_CHANGED,
|
139
|
|
- self._lastNEndpoints, endpointsEnteringLastN, obj);
|
|
136
|
+ lastNEndpoints, endpointsEnteringLastN, obj);
|
140
|
137
|
} else if (colibriClass === 'EndpointMessage') {
|
141
|
138
|
self.eventEmitter.emit(
|
142
|
139
|
RTCEvents.ENDPOINT_MESSAGE_RECEIVED, obj.from,
|
|
@@ -307,16 +304,4 @@ DataChannels.prototype.sendSetLastNMessage = function(value) {
|
307
|
304
|
logger.log(`Channel lastN set to: ${value}`);
|
308
|
305
|
};
|
309
|
306
|
|
310
|
|
-/**
|
311
|
|
- * Indicates if the endpoint id is currently included in the last N.
|
312
|
|
- *
|
313
|
|
- * @param id the endpoint id that we check for last N
|
314
|
|
- * @returns {boolean} {true} if the endpoint id is in the last N or if we
|
315
|
|
- * haven't initialised the last N array yet and {false} otherwise
|
316
|
|
- */
|
317
|
|
-DataChannels.prototype.isInLastN = function (id) {
|
318
|
|
- return !this._lastNEndpoints // lastNEndpoints not initialised yet
|
319
|
|
- || this._lastNEndpoints.indexOf(id) > -1;
|
320
|
|
-};
|
321
|
|
-
|
322
|
307
|
module.exports = DataChannels;
|