@@ -41,7 +41,7 @@ function wrapSend (send) {
4141
4242 const [ data , options , cb ] = arguments
4343
44- const ctx = { data, socket : this . _sender . _socket }
44+ const ctx = { data, socket : this . _sender ? ._socket }
4545
4646 return typeof cb === 'function'
4747 ? producerCh . traceCallback ( send , undefined , ctx , this , data , options , cb )
@@ -70,7 +70,7 @@ function createWrappedHandler (handler) {
7070 return function wrappedMessageHandler ( data , binary ) {
7171 const byteLength = dataLength ( data )
7272
73- const ctx = { data, binary, socket : this . _sender . _socket , byteLength }
73+ const ctx = { data, binary, socket : this . _sender ? ._socket , byteLength }
7474
7575 return receiverCh . traceSync ( handler , ctx , this , data , binary )
7676 }
@@ -93,7 +93,7 @@ function wrapClose (close) {
9393 // if both are true then the self is sending the close event
9494 const isPeerClose = this . _closeFrameReceived === true && this . _closeFrameSent === false
9595
96- const ctx = { code, data, socket : this . _sender . _socket , isPeerClose }
96+ const ctx = { code, data, socket : this . _sender ? ._socket , isPeerClose }
9797
9898 return closeCh . traceSync ( close , ctx , this , ...arguments )
9999 }
0 commit comments