morkai / h5.modbus

Implementation of the MODBUS IP/ASCII/RTU master and slave over TCP/UDP/Serial for Node.js.
https://miracle.systems/p/h5.modbus
MIT License
28 stars 21 forks source link

Reason of 'data' event removal from h5.modbus #23

Closed ekawahyu closed 6 years ago

ekawahyu commented 6 years ago

I am working on multiple Modbus devices using h5.modbus and virtual-serialport to form a virtual RS485 network on my computer. I found out that h5.modbus latest changes break data flow of virtual-serialport. Virtual-serialport expects to see 'data' event from h5.modbus in order to work. When I added back those 'data' event handler and binding within h5.modbus library, the virtual-serialport worked as expected. So, what was the reason for serialport 'data' event and binding removal in h5.modbus? Thank you.

morkai commented 6 years ago

SerialListener and SerialConnection were updated to the latest version of the serialport package.

According to the serialport's upgrade guide, the readable event is a preferred way of reading data over the data event (and in Node.js in general).

serialport is at version 6. virtual-serialport emulates serialport version <4.

Looking at the code of virtual-serialport you should be safe to swap to TCP/IP for testing.

ekawahyu commented 6 years ago

Ok, got it! Thanks for the clarification!