@@ -3,24 +3,28 @@ const transportName = process.argv[2] || 'local'
33const transportListen = require ( 'dop-transports' ) . listen [ transportName ]
44const transportConnect = require ( 'dop-transports' ) . connect [ transportName ]
55
6- function connect ( t , end = true , port2 = 56724 ) {
6+ function connect ( t , end = true , port1 = 12345 , port2 = 23456 ) {
77 return new Promise ( function ( response , reject ) {
88 const dopServer = dop . create ( )
99 const dopClient = dop . create ( )
1010 const dopSubClient = dop . create ( )
1111 dopServer . env = 'SERVER'
1212 dopClient . env = 'CLIENT'
1313 dopSubClient . env = 'SUBCLIENT'
14- const transportServer = dopServer . listen ( { transport : transportListen } )
15- const transportClientListen = dopClient . listen ( {
14+ const transportServer = dopServer . listen ( {
1615 transport : transportListen ,
17- port : port2
16+ port : port1
1817 } )
1918 const transportClient = dopClient . connect ( {
20- transport : transportConnect
19+ transport : transportConnect ,
20+ url : 'ws://localhost:' + port1
2121 } )
2222
2323 transportClient . on ( 'connect' , function ( nodeClient ) {
24+ const transportClientListen = dopClient . listen ( {
25+ transport : transportListen ,
26+ port : port2
27+ } )
2428 const transportSubClient = dopSubClient . connect ( {
2529 transport : transportConnect ,
2630 url : 'ws://localhost:' + port2
0 commit comments