@@ -8,6 +8,7 @@ import wrtc from 'wrtc';
8
8
import MewConnectCommon from '../MewConnectCommon' ;
9
9
import MewConnectCrypto from '../MewConnectCrypto' ;
10
10
import WebRtcCommunication from '../WebRtcCommunication' ;
11
+ import { stunServers } from '../config' ;
11
12
12
13
const debug = debugLogger ( 'MEWconnect:initiator-V2' ) ;
13
14
const debugTurn = debugLogger ( 'MEWconnect:turn-V2' ) ;
@@ -63,7 +64,7 @@ export default class MewConnectInitiatorV2 extends MewConnectCommon {
63
64
// }, 120000);
64
65
65
66
// WebRTC options
66
- this . iceTransportPolicy = 'all'
67
+ this . iceTransportPolicy = 'all' ;
67
68
this . trickle = true ;
68
69
} catch ( e ) {
69
70
debug ( 'constructor error:' , e ) ;
@@ -236,10 +237,9 @@ export default class MewConnectInitiatorV2 extends MewConnectCommon {
236
237
} ) ;
237
238
238
239
this . socketOn ( this . signals . initiated , this . initiated . bind ( this ) ) ; // response
239
- this . socketOn (
240
- this . signals . confirmation ,
241
- this . beginRtcSequence . bind ( this , '' )
242
- ) ; // response
240
+ this . socketOn ( this . signals . confirmation , data => {
241
+ this . beginRtcSequence ( stunServers ) ;
242
+ } ) ; // response
243
243
// this.signals.answer
244
244
this . socketOn ( 'answer' , this . recieveAnswer . bind ( this ) ) ;
245
245
this . socketOn (
@@ -323,13 +323,14 @@ export default class MewConnectInitiatorV2 extends MewConnectCommon {
323
323
debug ( 'initiator' , this . signals . initiated , data ) ;
324
324
}
325
325
326
- beginRtcSequence ( data ) {
326
+ beginRtcSequence ( stunServers ) {
327
327
this . emit ( 'socketPaired' ) ;
328
328
this . emit ( 'beginRtcSequence' , 'V2' ) ;
329
329
try {
330
330
debug ( 'beginRtcSequence ' ) ;
331
- debug ( 'sendOffer' , data ) ;
331
+ debug ( 'sendOffer' , stunServers ) ;
332
332
this . iceServers = null ;
333
+ this . stunServers = stunServers ;
333
334
const options = {
334
335
servers : this . stunServers ,
335
336
webRtcConfig : {
0 commit comments