File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -116,10 +116,7 @@ class WebSocket extends EventEmitter {
116116 get bufferedAmount ( ) {
117117 if ( ! this . _socket ) return this . _bufferedAmount ;
118118
119- //
120- // `socket.bufferSize` is `undefined` if the socket is closed.
121- //
122- return ( this . _socket . bufferSize || 0 ) + this . _sender . _bufferedBytes ;
119+ return this . _socket . _writableState . length + this . _sender . _bufferedBytes ;
123120 }
124121
125122 /**
Original file line number Diff line number Diff line change @@ -208,12 +208,15 @@ describe('WebSocket', () => {
208208 wss . on ( 'connection' , ( ws ) => {
209209 const data = Buffer . alloc ( 1024 , 61 ) ;
210210
211- while ( ws . _socket . bufferSize === 0 ) {
211+ while ( ws . bufferedAmount === 0 ) {
212212 ws . send ( data ) ;
213213 }
214214
215- assert . ok ( ws . _socket . bufferSize > 0 ) ;
216- assert . strictEqual ( ws . bufferedAmount , ws . _socket . bufferSize ) ;
215+ assert . ok ( ws . bufferedAmount > 0 ) ;
216+ assert . strictEqual (
217+ ws . bufferedAmount ,
218+ ws . _socket . _writableState . length
219+ ) ;
217220
218221 ws . on ( 'close' , ( ) => wss . close ( done ) ) ;
219222 ws . close ( ) ;
You can’t perform that action at this time.
0 commit comments