Replies: 1 comment
-
Ok, further reading of the documentation leads to the conclusion, that my idea is not working due to the following issue: InterByteTimeout parser needs one byte to be received to begin the timeout. So it waits for the first char for ever and therefore So here a clarification of what should happen and which timeouts are needed.
Any hint how to achive this will be appreciated. If i'm wrong at any point, you are welcome to point out my misconception. Thanks in advance again... Regards |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
first of all i'll want to thank all of the people involved into serialport. It is an amazing library.
Now the job is to realize a protokol with different timeouts. Therefore i think of using InterByteTimeout. To change the timeout i use the following code:
parser = port.pipe(new InterByteTimeout( {interval: newTimeout, maxBufferSize: newBufferSize} ))
On the 11th change the following warnings are thrown:
(node:6404) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 end listeners added to [SerialPort]. Use emitter.setMaxListeners() to increase limit
(node:6404) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added to [SerialPort]. Use emitter.setMaxListeners() to increase limit
Increasing the count of possible listeners will not solve the problem, since the protocol will run for hours, handling tons of transmissions. The clean and only way is to avoid touching the limit for the listeners.
At this point i have the following questions:
Is this the right implementation for the problem or would it be better to use javascript timers?
How should i set a new timeout to avoid the warnings if its the right way ?
Many thanks in advance...
Regards
PS: Full stacktrace (--trace-warnings) for the warnings
Beta Was this translation helpful? Give feedback.
All reactions