npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-error-on-timeout

v1.2.4

Published

Node that triggers an error if a message is not received within the configured time frame. Also has an output for "late" messages.

Downloads

32

Readme

node-red-contrib-error-on-timeout

Node red contribution node that triggers an error if a second message has not been received within a configurable timeframe.

Example usage

Usage

This node receives at first a message with the eot_trigger property set and then starts the delay until a message with the eot_input flag arrives.


Warning

This node is not suitable for high frequency message processing. It is meant to help control the flow by checking a command / acknowledgement pattern such as switching equipment on and off. See my use case.

Dead lock

Once the node receives a message with the eot_trigger flag set, it'll be waiting for a message with the eot_input flag and won't accept any more trigger messages untile the configured timeout has been triggered.


Outputs

  1. Success output: All messages that have arrived within the configured timeframe
  2. Error output: When no message arrives within the configured timeframe
  3. Late output: All messages that arrived after the configured timeframe

Programmatic configuration of the timeout interval

The message with the eot_trigger property can have a eot_timeout property set to the desired interval in milliseconds.


Latency stats

The following properties/fields are added to the messages coming out of each individual output of the node:

| Output | Fields | |--- |--- | | Success | eot_timeout Configured timeout in millisecondseot_time Time in milliseconds it took until the expected message arrived | | Error | topic is set to error-on-timeoutpayload Formatted error message reading Input message not received within ${timeout} mseot_trigger A copy of the message that triggered the timer that resulted in the timeout | | Late | eot_timeout Configured timeout in millisecondseot_time Time in milliseconds it took until the late message arrivedeot_late Late time in milliseconds |


My use case

I'm working on an IoT project running on MQTT where successfull execution of commands is crucial. After sending a command to a device I needed to ensure that the command has been executed successfully by having the device send out an ack message within a certain timeframe before turning on other heavy duty equipment (and potentially blow up the entire infrastructure).

sequenceDiagram
    Actor Node Red
    Actor Selenoid
    Actor Pump
    Node Red->>Selenoid: Open
    Selenoid->>Node Red: ACK
    Node Red->>Pump: Run
    Pump->>Node Red: ACK

The default nodes that come with Node Red seemed to be too... redundant for my needs and I preferred to develop something simple and concise and wrap it into a node.

I sincerely do hope that you make good use of it.


Please see the examples by importing them through the Import > Examples dialog.