Firstly, Relevant info...
npm -v 6.9.0 21 Jun 15:40:03 - [info] Node-RED version: v0.20.5 21 Jun 15:40:03 - [info] Node.js version: v10.16.0 21 Jun 15:40:03 - [info] Windows_NT 10.0.17763 x64 LE
I have an issue with the TCP Request node staying connected when "
after a fixed timeout of" option is set in the Return property (ms is set to 10000ms / 10s).
TCP Request Node Settings...
But 5 mins later, node is still connected...
I believe the reason is
setTimeout isn't called unless data arrives back from the TCP endpoint. see here. This is where I have a problem though - this particular unit never sends any data back (by design) so the
setTimeout function is never called and the connection remains connected.
Can anyone confirm similar behaviour?
Is this by design?
I can post sample code however you would need a TCP device or application that will accept data & not reply, to test it.
If this is a bug or unexpected condition that needs some attention, a workaround might be...
- Upon the node receiving a msg, if there is no ID in original-timeout or no-data-timeout , setup a no-data-timeout.
- If a 2nd/3rd... msg is received before the no-data-timeout occurs, restart the no-data-timeout.
- If data is received, clear the no-data-timeout & setup the original-timeout.
- Upon no-data-timeout, send an empty payload and disconnect.