TCP IN/OUT/REQUEST Deeper Code Help

I'm going to start with a story first, I have been playing with creation of a node.

I have adapted the tcpin js, currently I have just added in very simply for the node to output every return message from the end point.
This has been super useful as my user case requires a number of back and forth messages on the same stream [IoT] with expected inputs and outputs from both sides.
this has been working swimmingly.

My end question is, there are small occasions when the end point responds incorrectly, this results in my request node staying open indefinitely.
My best case result is that I can create a kill switch, something outside the node that can be input to close down the connection gracefully.
I have read through the code a number of times and run some tests, but I was hoping that someone has any suggestions as to how to implement this in the js, best place, best lines of code, etc?

Plus, what I am doing may be useful to others and so i want to put this out there and discuss.

I love the platform, it is so helpful for what I'm trying to achieve [load testing in a virtual manner]

thanks all,

Mike

I know it is to do with these lines of code

                                            if (clients[connection_id].client) {
                                                node.status({});
                                                clients[connection_id].client.destroy();
                                                delete clients[connection_id];
                                            }

Also, my ther thoughts are just being able to keep a TTL in the js code, so that it dies over a picked time. It is less useful for the future but suits my current

a kill switch is much more useful.

I understand about the tcpin and out being better suited to long held comms, but my end is the one opening the comms, and the port on my side is not fixed, as I will be using at the least 50 tcp streams.

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