File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -364,21 +364,25 @@ module.exports = function (RED) {
364364 connection : function ( conn ) {
365365 if ( config . events === 'all' || config . events === 'connect' ) {
366366 const wNode = RED . nodes . getNode ( node . id )
367- let msg = {
368- payload : 'connect'
367+ if ( wNode && typeof wNode . send === 'function' ) {
368+ let msg = {
369+ payload : 'connect'
370+ }
371+ msg = addConnectionCredentials ( RED , msg , conn , ui )
372+ wNode . send ( msg )
369373 }
370- msg = addConnectionCredentials ( RED , msg , conn , ui )
371- wNode . send ( msg )
372374 }
373375 } ,
374376 disconnect : function ( conn ) {
375377 if ( config . events === 'all' || config . events === 'connect' ) {
376378 const wNode = RED . nodes . getNode ( node . id )
377- let msg = {
378- payload : 'lost'
379+ if ( wNode && typeof wNode . send === 'function' ) {
380+ let msg = {
381+ payload : 'lost'
382+ }
383+ msg = addConnectionCredentials ( RED , msg , conn , ui )
384+ wNode . send ( msg )
379385 }
380- msg = addConnectionCredentials ( RED , msg , conn , ui )
381- wNode . send ( msg )
382386 }
383387 } ,
384388 'ui-control' : function ( conn , id , evt , payload ) {
You can’t perform that action at this time.
0 commit comments