Give output of a node based on a service call done in fixed time intervals



I have a node which has 0 inputs and 1 output. I need to use this node as a mediator which converts and forwards the response of a rest service based on a specific parameter of the response. I have to implement this node to send requests to the REST service every 5 seconds and give output based on the response from the requested service. I do not know how to perform an action without an explicit call to a node. Up to now, I used

//perform action
//then send output

which performs some action when we give an input to the node. How can we perform some action (REST service call) without 'input' event or any other explicit event? The node should start this action once it is deployed.
How can I do this?


That is what the inject node is for. It will trigger at the interval you set it to.


Have a look at the standard JavaScript setInterval function. It can be used to call a function at regular intervals. You must make sure you use clearInterval in your nodes close handler to stop calling the function after the node has been removed.

You can have a look at the feed parser node as an example :


Ahhh inputs so you can't connect an inject - ignore my suggestion. :roll_eyes:


Surely it is a matter of choice whether it has an input.