nodes/uiblib.js
function(msg, node, RED, io, ioNs, log) {
        node.rcvMsgCount++
        log.verbose(`[${node.url}] msg received via FLOW. ${node.rcvMsgCount} messages received`, msg)

        // If the input msg is a uibuilder control msg, then drop it to prevent loops
        if ( msg.hasOwnProperty('uibuilderCtrl') ) return null

        //setNodeStatus({fill: 'yellow', shape: 'dot', text: 'Message Received #' + node.rcvMsgCount}, node)

        // Remove script/style content if admin settings don't allow
        if ( node.allowScripts !== true ) {
            if ( msg.hasOwnProperty('script') ) delete msg.script
        }
        if ( node.allowStyles !== true ) {
            if ( msg.hasOwnProperty('style') ) delete msg.style
        }

        // pass the complete msg object to the uibuilder client
        // TODO: This should have some safety validation on it!
        if (msg._socketId) {
            log.debug(`[${node.url}] msg sent on to client ${msg._socketId}. Channel: ${node.ioChannels.server}`, msg)
            ioNs.to(msg._socketId).emit(node.ioChannels.server, msg)
        } else {
            log.debug(`[${node.url}] msg sent on to ALL clients. Channel: ${node.ioChannels.server}`, msg)
            ioNs.emit(node.ioChannels.server, msg)
        }

        if (node.fwdInMessages) {
            // Send on the input msg to output
            node.send(msg)
            log.debug(`[${node.url}] msg passed downstream to next node`, msg)
        }

        return msg
    }
function(msg, node, RED, io, ioNs, log) {
        node.rcvMsgCount++
        log.verbose(`[${node.url}] msg received via FLOW. ${node.rcvMsgCount} messages received`, msg)

        // If the input msg is a uibuilder control msg, then drop it to prevent loops
        if ( msg.hasOwnProperty('uibuilderCtrl') ) return null

        //setNodeStatus({fill: 'yellow', shape: 'dot', text: 'Message Received #' + node.rcvMsgCount}, node)

        // Remove script/style content if admin settings don't allow
        if ( node.allowScripts !== true ) {
            if ( msg.hasOwnProperty('script') ) delete msg.script
        }
        if ( node.allowStyles !== true ) {
            if ( msg.hasOwnProperty('style') ) delete msg.style
        }

        // pass the complete msg object to the uibuilder client
        // TODO: This should have some safety validation on it!
        if (msg._socketId) {
            log.debug(`[${node.url}] msg sent on to client ${msg._socketId}. Channel: ${node.ioChannels.server}`, msg)
            ioNs.to(msg._socketId).emit(node.ioChannels.server, msg)
        } else {
            log.debug(`[${node.url}] msg sent on to ALL clients. Channel: ${node.ioChannels.server}`, msg)
            ioNs.emit(node.ioChannels.server, msg)
        }

        if (node.fwdInMessages) {
            // Send on the input msg to output
            node.send(msg)
            log.debug(`[${node.url}] msg passed downstream to next node`, msg)
        }

        return msg
    }
function ( msg , node , RED , io , ioNs , log ) { node . rcvMsgCount ++ log . verbose ( ` ${ node . url } ${ node . rcvMsgCount } ` , msg ) // If the input msg is a uibuilder control msg, then drop it to prevent loops if ( msg . hasOwnProperty ( 'uibuilderCtrl' ) ) return null //setNodeStatus({fill: 'yellow', shape: 'dot', text: 'Message Received #' + node.rcvMsgCount}, node) // Remove script/style content if admin settings don't allow if ( node . allowScripts !== true ) { if ( msg . hasOwnProperty ( 'script' ) ) delete msg . script } if ( node . allowStyles !== true ) { if ( msg . hasOwnProperty ( 'style' ) ) delete msg . style } // pass the complete msg object to the uibuilder client // TODO: This should have some safety validation on it! if ( msg . _socketId ) { log . debug ( ` ${ node . url } ${ msg . _socketId } ${ node . ioChannels . server } ` , msg ) ioNs . to ( msg . _socketId ) . emit ( node . ioChannels . server , msg ) } else { log . debug ( ` ${ node . url } ${ node . ioChannels . server } ` , msg ) ioNs . emit ( node . ioChannels . server , msg ) } if ( node . fwdInMessages ) { // Send on the input msg to output node . send ( msg ) log . debug ( ` ${ node . url } ` , msg ) } return msg }
Complex, custom code when processing an incoming msg should go here Needs to return the msg object
Complex custom code when processing an incoming msg should go here Needs to return the msg object