diff --git a/lib/client/websocket-tracker.js b/lib/client/websocket-tracker.js index 82d7be4..e021e92 100644 --- a/lib/client/websocket-tracker.js +++ b/lib/client/websocket-tracker.js @@ -276,11 +276,7 @@ WebSocketTracker.prototype._onAnnounceResponse = function (data) { var peer if (data.offer && data.peer_id) { debug('creating peer (from remote offer)') - peer = self._createPeer({ - trickle: false, - config: self.client._rtcConfig, - wrtc: self.client._wrtc - }) + peer = self._createPeer() peer.id = common.binaryToHex(data.peer_id) peer.once('signal', function (answer) { var params = { @@ -389,12 +385,7 @@ WebSocketTracker.prototype._generateOffers = function (numwant, cb) { function generateOffer () { var offerId = randombytes(20).toString('hex') debug('creating peer (from _generateOffers)') - var peer = self.peers[offerId] = self._createPeer({ - initiator: true, - trickle: false, - config: self.client._rtcConfig, - wrtc: self.client._wrtc - }) + var peer = self.peers[offerId] = self._createPeer({ initiator: true }) peer.once('signal', function (offer) { offers.push({ offer: offer, @@ -421,6 +412,13 @@ WebSocketTracker.prototype._generateOffers = function (numwant, cb) { WebSocketTracker.prototype._createPeer = function (opts) { var self = this + + opts = Object.assign({ + trickle: false, + config: self.client._rtcConfig, + wrtc: self.client._wrtc + }, opts) + var peer = new Peer(opts) peer.once('error', onError)