You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement a nodejs server application that reads data from a connected device over a USB port. The communication is based on UART and the protocol swaps from strings to bytes being sent.
More specifically, I need to send a read command, which will return a string of the length of the file (e.g. 25600). After this, my server application sends an acknowledgment and 1000 bytes will be received, I send ack and another 1000 bytes are received and this goes on until the last message, which in this example will return 600 bytes.
For this protocol, I implemented a new parser (1000 bytes, length % 1000 bytes and newline) for every new type of communication I expect and remove the old ones (with port.removeAllListeners("data"))
After a couple of files, I receive the MaxListenersExceededWarning. I know I can increase this, but I would feel more comfortable to just remove the listeners.
In the documentation, I cannot find how to remove listeners. Am I doing something wrong or is this just missing from the documentation?
The text was updated successfully, but these errors were encountered:
In the end, the SerialPort class class just extends the EventEmitter class. This means that removing an event listener is just as easy as adding an event listener; just call the off method in the same way you called the on method. Make sure whatever you passed into the on method references the same function as what you pass into the off method.
I am trying to implement a nodejs server application that reads data from a connected device over a USB port. The communication is based on UART and the protocol swaps from strings to bytes being sent.
More specifically, I need to send a read command, which will return a string of the length of the file (e.g. 25600). After this, my server application sends an acknowledgment and 1000 bytes will be received, I send ack and another 1000 bytes are received and this goes on until the last message, which in this example will return 600 bytes.
For this protocol, I implemented a new parser (1000 bytes, length % 1000 bytes and newline) for every new type of communication I expect and remove the old ones (with port.removeAllListeners("data"))
After a couple of files, I receive the MaxListenersExceededWarning. I know I can increase this, but I would feel more comfortable to just remove the listeners.
In the documentation, I cannot find how to remove listeners. Am I doing something wrong or is this just missing from the documentation?
The text was updated successfully, but these errors were encountered: