File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -355,16 +355,18 @@ class WebSocket extends EventEmitter {
355355 if ( typeof data === 'number' ) data = data . toString ( ) ;
356356 else if ( ! data ) data = '' ;
357357
358- options = options || { } ;
359- if ( options . fin !== false ) options . fin = true ;
360- if ( options . binary === undefined ) options . binary = typeof data !== 'string' ;
361- if ( options . mask === undefined ) options . mask = ! this . _isServer ;
362- if ( options . compress === undefined ) options . compress = true ;
358+ const opts = Object . assign ( {
359+ fin : true ,
360+ binary : typeof data !== 'string' ,
361+ mask : ! this . _isServer ,
362+ compress : true
363+ } , options ) ;
364+
363365 if ( ! this . extensions [ PerMessageDeflate . extensionName ] ) {
364- options . compress = false ;
366+ opts . compress = false ;
365367 }
366368
367- this . _sender . send ( data , options , cb ) ;
369+ this . _sender . send ( data , opts , cb ) ;
368370 }
369371
370372 /**
You can’t perform that action at this time.
0 commit comments