MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 scanStop listeners added. Use emitter.setMaxListeners() to increase limit #22

Agree, but in my case I really need Subflow because of the UI that abstract a lot of things.

I tried to put the "WebSocket Out" node outside of the SubSubSubflow and it works ! I no longer have the Warning emitter.setMaxListener() but it is not a solution.

Because I can't create a link node into my SubSubSubflow to target a node that would call the WebSocket node. In you case it works because you are using only Flow

To my knowledge there is no "Hack" or exposed API to call a Node1 from a Node2 explicilty ?

(For another case, I did something very cool with a callback function that let jump to another node)

There is. As already explained, the LinkCall / LinkOut core nodes provide this functionality.
It's setup like this:

Flow:

[
    {
        "id": "5ea31b0cb5dea699",
        "type": "tab",
        "label": "Flow 9",
        "disabled": false,
        "info": "",
        "env": [],
        "_mcu": {
            "mcu": false
        }
    },
    {
        "id": "e2e2f772a1eff8f6",
        "type": "inject",
        "z": "5ea31b0cb5dea699",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "10",
        "payloadType": "num",
        "_mcu": {
            "mcu": false
        },
        "x": 170,
        "y": 180,
        "wires": [
            [
                "e94b8d48fd6572be"
            ]
        ]
    },
    {
        "id": "e94b8d48fd6572be",
        "type": "link call",
        "z": "5ea31b0cb5dea699",
        "name": "",
        "links": [
            "1944c969ede348f0"
        ],
        "linkType": "static",
        "timeout": "30",
        "_mcu": {
            "mcu": false
        },
        "x": 340,
        "y": 180,
        "wires": [
            [
                "b8df104959731e08"
            ]
        ]
    },
    {
        "id": "1944c969ede348f0",
        "type": "link in",
        "z": "5ea31b0cb5dea699",
        "name": "Call Me",
        "links": [],
        "_mcu": {
            "mcu": false
        },
        "x": 150,
        "y": 360,
        "wires": [
            [
                "de509aa2a88babcc"
            ]
        ],
        "l": true
    },
    {
        "id": "de509aa2a88babcc",
        "type": "function",
        "z": "5ea31b0cb5dea699",
        "name": "payload * 2",
        "func": "msg.payload *= 2;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "_mcu": {
            "mcu": false
        },
        "x": 310,
        "y": 360,
        "wires": [
            [
                "ea769cc1776c3305"
            ]
        ]
    },
    {
        "id": "ea769cc1776c3305",
        "type": "link out",
        "z": "5ea31b0cb5dea699",
        "name": "link out 4",
        "mode": "return",
        "links": [],
        "_mcu": {
            "mcu": false
        },
        "x": 435,
        "y": 360,
        "wires": []
    },
    {
        "id": "b8df104959731e08",
        "type": "debug",
        "z": "5ea31b0cb5dea699",
        "name": "=> Debug",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": false
        },
        "x": 500,
        "y": 180,
        "wires": []
    },
    {
        "id": "516b3e5fa463a95c",
        "type": "inject",
        "z": "5ea31b0cb5dea699",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "25",
        "payloadType": "num",
        "_mcu": {
            "mcu": false
        },
        "x": 170,
        "y": 240,
        "wires": [
            [
                "4542b0fc3a8073cb"
            ]
        ]
    },
    {
        "id": "4542b0fc3a8073cb",
        "type": "link call",
        "z": "5ea31b0cb5dea699",
        "name": "",
        "links": [
            "1944c969ede348f0"
        ],
        "linkType": "static",
        "timeout": "30",
        "_mcu": {
            "mcu": false
        },
        "x": 340,
        "y": 240,
        "wires": [
            [
                "ce3825622b5df917"
            ]
        ]
    },
    {
        "id": "ce3825622b5df917",
        "type": "debug",
        "z": "5ea31b0cb5dea699",
        "name": "=> Debug",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": false
        },
        "x": 500,
        "y": 240,
        "wires": []
    },
    {
        "id": "58e5a97758e7a7c0",
        "type": "comment",
        "z": "5ea31b0cb5dea699",
        "name": "This behaves like a standard sub-routine",
        "info": "",
        "_mcu": {
            "mcu": false
        },
        "x": 260,
        "y": 320,
        "wires": []
    }
]

No need for any hack! :+1:

Thanks but as I explained it do not work in a subflow. You can't call from a Subflow an external Link Node

I find a kludge work around using JS CallBack that works very well.

Yes you can.

Isn't there an open issue for this? Upgrading from 4.0.2 to 4.0.3 seems to break link calls inside subflows Ā· Issue #4891 Ā· node-red/node-red Ā· GitHub

Yes, it is an unfortunate blip - since resolved (v4.0.4 incoming very soon) but 4.0.2 (and every version before, it does work). Also, under the hood, even 4.0.3 works (you have to use msg.target or edit the flow JSON - i.e. its a frontend issue)

1 Like

I really need Subflow because of the UI that abstract a lot of things

But you can still abstract it in a 'subroutine' with a link call node and only use the subflow for the UI part that emits all the properties that you need.

Install node red 4.0.2 and wait for the bugfix before installing the latest.
Depending on how you installed node-red that may be done using something like
sudo npm install --unsafe-perm node-red@4.0.2
then restarting node-red.