# Messages not being received in the debug node untill the native addon has finished sending all messages

**URL:** <https://discourse.nodered.org/t/messages-not-being-received-in-the-debug-node-untill-the-native-addon-has-finished-sending-all-messages/61663>\
**Category:** General\
**Created:** [22 April 2022 20:53 UTC](https://discourse.nodered.org/t/messages-not-being-received-in-the-debug-node-untill-the-native-addon-has-finished-sending-all-messages/61663 "2022-04-22T20:53:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hishamjz](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@Hishamjz](https://discourse.nodered.org/u/Hishamjz)\
**Post date:** [22 April 2022 20:53 UTC](https://discourse.nodered.org/t/messages-not-being-received-in-the-debug-node-untill-the-native-addon-has-finished-sending-all-messages/61663/1 "2022-04-22T20:53:37Z")

</div>

Hello Node-RED community,

I am importing a C++ addon into my Node-RED to send samples from my Analog Discovery 2 device into Node-RED using NAPI. The C++ code basically sends samples from the device to Node-RED using event emitter for each sample sent. The sampling rate is 500 samples/seconds. I can see in the Node-RED window the metric info that the function acutally sends messages upon receiving from the addon each second to Node-RED, but later on after all the samples has been sent (2mins) can see the debug node starting to receive those messages and showing them. I am interested in signal real-time analysis so that's why I would like that the messages get sent upon receiving simultaneously and shown in the debug node (or sent to another node for further simultaneous processing)  
. I read about the Asynchronous behaviour of Node-RED that's expected it to work the way I want. I tried using node.done() after each node.send(msg) and also wrapping it in a new node, but the same occurs. Is there a way to let this work simultaneously?  
Thanks so much for any helpers.

```auto
const EventEmitter = require('events');

const test = require('C:/directory/build/Release/addon');

const emitter = new EventEmitter();
var a;
emitter.on('something',(evt)=>{ a=(evt);msg.payload=a;node.send(msg);node.done();})
test.Hello(emitter.emit.bind(emitter));

```

 ![sent](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/8/98c7f78a28cc358ec55f095a9608889af528a7e8.jpeg)

 ![receive](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/7/978d7dc79e0d444fcc3271279b8a033f864c102c.jpeg)

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [22 April 2022 21:02 UTC](https://discourse.nodered.org/t/messages-not-being-received-in-the-debug-node-untill-the-native-addon-has-finished-sending-all-messages/61663/2 "2022-04-22T21:02:22Z")

</div>

Use node.warn(value) before node.send, to see the value just in time before value is sent.

---

<div class="post-metadata">

**Author:** ![Hishamjz](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@Hishamjz](https://discourse.nodered.org/u/Hishamjz)\
**Post date:** [22 April 2022 21:05 UTC](https://discourse.nodered.org/t/messages-not-being-received-in-the-debug-node-untill-the-native-addon-has-finished-sending-all-messages/61663/3 "2022-04-22T21:05:10Z")

</div>

> [@mickym2](#):
>
> node.warn(value)

Thanks for the reply, I am also interested in further processing of the message in a later node, so I am interested that the message is received in the next node simultaneously.

---

<div class="post-metadata">

**Author:** ![Hishamjz](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@Hishamjz](https://discourse.nodered.org/u/Hishamjz)\
**Post date:** [22 April 2022 21:10 UTC](https://discourse.nodered.org/t/messages-not-being-received-in-the-debug-node-untill-the-native-addon-has-finished-sending-all-messages/61663/4 "2022-04-22T21:10:34Z")

</div>

For the warn function, it also showed the values after all the sending was done.

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [22 April 2022 21:12 UTC](https://discourse.nodered.org/t/messages-not-being-received-in-the-debug-node-untill-the-native-addon-has-finished-sending-all-messages/61663/5 "2022-04-22T21:12:54Z")

</div>

I think I cant help you further. I even do not know if this is possible at all. As far as I know - Node Red is working single threaded , so even async processing will not be processed in parallel. But I think a developer of NR has to respond to your request.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 June 2022 21:13 UTC](https://discourse.nodered.org/t/messages-not-being-received-in-the-debug-node-untill-the-native-addon-has-finished-sending-all-messages/61663/6 "2022-06-21T21:13:16Z")

</div>

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