# Pass every nth message

**URL:** <https://discourse.nodered.org/t/pass-every-nth-message/9419>\
**Category:** General\
**Created:** [25 March 2019 20:45 UTC](https://discourse.nodered.org/t/pass-every-nth-message/9419 "2019-03-25T20:45:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![igrowing](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/igrowing/32/663_2.png) [@igrowing](https://discourse.nodered.org/u/igrowing)\
**Post date:** [25 March 2019 20:45 UTC](https://discourse.nodered.org/t/pass-every-nth-message/9419/1 "2019-03-25T20:45:51Z")

</div>

Hi,

Is there a node which can Pass every nth message?  
Pass msg, drop N-1 messages, Pass msg, drop N-1 messages, etc...

I couldn't find such node...  
Thank you.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [25 March 2019 21:06 UTC](https://discourse.nodered.org/t/pass-every-nth-message/9419/2 "2019-03-25T21:06:24Z")

</div>

Have a look at the join node.

---

<div class="post-metadata">

**Author:** ![igrowing](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/igrowing/32/663_2.png) [@igrowing](https://discourse.nodered.org/u/igrowing)\
**Post date:** [25 March 2019 21:11 UTC](https://discourse.nodered.org/t/pass-every-nth-message/9419/3 "2019-03-25T21:11:17Z")

</div>

Tried "join" node in different permutations for 2 hours.  
I couldn't understand how to configure it to pass every nth message and drop the rest.  
Any hint is appreciated 🙂

Then i wrote my own function which doesn't work too... ☹

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [25 March 2019 21:13 UTC](https://discourse.nodered.org/t/pass-every-nth-message/9419/4 "2019-03-25T21:13:53Z")

</div>

Could you post a sample of your data and explain exactly what you are trying to achieve?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [25 March 2019 21:14 UTC](https://discourse.nodered.org/t/pass-every-nth-message/9419/5 "2019-03-25T21:14:23Z")

</div>

Hi @igrowing,

I use always the [node-red-contrib-throttle](https://www.npmjs.com/package/node-red-contrib-throttle#example-by-block-size) when I need such functionality : see ' **by counter**' option...  
Bart

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 March 2019 21:29 UTC](https://discourse.nodered.org/t/pass-every-nth-message/9419/6 "2019-03-25T21:29:41Z")

</div>

If what you are actually trying to do is to limit the rate at which you receive messages, throwing away intermediate ones, the you can use a Delay node set to Rate Limit mode with Discard Intermediate Messages selected.  
Alternatively if the reason you want to ignore them is because they are repeated messages then you could use an RBE node, which will ignore repeated messages, sending a message only when it gets one with different content.

---

<div class="post-metadata">

**Author:** ![igrowing](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/igrowing/32/663_2.png) [@igrowing](https://discourse.nodered.org/u/igrowing)\
**Post date:** [26 March 2019 07:06 UTC](https://discourse.nodered.org/t/pass-every-nth-message/9419/7 "2019-03-26T07:06:54Z")

</div>

@BartButenaers, @Colin Thank you very much.  
Both proposals do what I was looking for.

Since "delay" comes by default, I'll go with it.
