# Unexpected behaviour with link call

**URL:** <https://discourse.nodered.org/t/unexpected-behaviour-with-link-call/53133>\
**Category:** General\
**Created:** [2 November 2021 16:09 UTC](https://discourse.nodered.org/t/unexpected-behaviour-with-link-call/53133 "2021-11-02T16:09:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edo78](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edo78/32/19682_2.png) [@Edo78](https://discourse.nodered.org/u/Edo78)\
**Post date:** [2 November 2021 16:09 UTC](https://discourse.nodered.org/t/unexpected-behaviour-with-link-call/53133/1 "2021-11-02T16:09:37Z")

</div>

I'm not sure if I'm missing something or if it's a bug so I'd ask before opening an issue.

This simple example show the issue.  
If the link out node is set to `Send to all connected link nodes` the flow doesn't works and it's always throwing a `timeout` error.  
The only way to have it run is to set the link out node to `Return to calling link node`  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/a/5ac5ac20c8736660d1b343bb2ac6ee8be2612eda.png)

```auto
[{"id":"b8edcaf033d3751c","type":"link in","z":"e1f44cc40f36d3a0","name":"Link In Test","links":[],"x":170,"y":780,"wires":[["ea8171f04afbcc02"]],"l":true},{"id":"ea8171f04afbcc02","type":"link out","z":"e1f44cc40f36d3a0","name":"Link Out Test","mode":"link","links":[],"x":530,"y":780,"wires":[],"l":true},{"id":"13b7d6bd600d7fbd","type":"inject","z":"e1f44cc40f36d3a0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":900,"wires":[["a2b252ddf5afe8c5"]]},{"id":"a2b252ddf5afe8c5","type":"link call","z":"e1f44cc40f36d3a0","name":"","links":["b8edcaf033d3751c"],"timeout":"1","x":350,"y":900,"wires":[["8f56d94a93a51a14"]]},{"id":"8f56d94a93a51a14","type":"debug","z":"e1f44cc40f36d3a0","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":900,"wires":[]}]

```

Is it working as intended? Where can I find some documentation about its rationale?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [2 November 2021 16:23 UTC](https://discourse.nodered.org/t/unexpected-behaviour-with-link-call/53133/2 "2021-11-02T16:23:13Z")

</div>

You need to set the link out to return mode.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d40f1001046974a095c2b2e1482152190ed5be10.png)

Think of it this way...

- the link call is a Subroutine call
- the link-in is a Subroutine Definition
- the Link Out (set for return mode) is the Subroutine Return.

Where it is useful : Consider you had a flow or function that turned your payoad array into an object with named properties - BUT - you needed to do this on several flow tabs - you could create a "subroutine" (link in, lin out) and call it (link call) from multiple places and it will only return to the caller.

---

<div class="post-metadata">

**Author:** ![Edo78](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edo78/32/19682_2.png) [@Edo78](https://discourse.nodered.org/u/Edo78)\
**Post date:** [2 November 2021 16:49 UTC](https://discourse.nodered.org/t/unexpected-behaviour-with-link-call/53133/3 "2021-11-02T16:49:09Z")

</div>

Thank you for your explanation.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 November 2021 16:49 UTC](https://discourse.nodered.org/t/unexpected-behaviour-with-link-call/53133/4 "2021-11-16T16:49:22Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
