Content aware debounce

Any suggestion on how to debounce based on payload value?

messages are coming in via http request from multiple clients to the same endpoint
node-red/getInfo?client=<client-id>
some clients mite access the url multiple times per minute
the goal is to send a single message per minute per client-id

using a simple debounce is not a good ideea because it could lead to data loss when multiple clients mke their requests at the same time

If I understand what you want correctly then the Delay node in Rate Limit, For Each msg.topic should do it.

const ctxTo = context.get(clientId);
clearTimeout(ctxTo);

const to = setTimeout(() => {
    node.send({
        payload: clientId,
    });
}, 1000)

context.set(clientId, to);

I think this should do it

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