Package Exports
- @modbus-ts/core
Readme
@modbus-ts/core
Core contracts and error types used across modbus-ts packages.
Installation
pnpm add @modbus-ts/coreCore Exports
- ConnectionState
- Transport
- ModbusRequest
- ModbusResponse
- RequestTask
- Subscription
- TimeoutError
- ConnectionClosedError
- ProtocolError
- TransportError
Minimal Example
import { ProtocolError, type Transport } from '@modbus-ts/core'
function assertConnected(transport: Transport): void {
if (!transport) {
throw new ProtocolError('transport missing')
}
}Why This Package Exists
- Defines stable cross-package interfaces
- Standardizes error naming and behavior
- Keeps transport and protocol layers decoupled
Packages
high-level Modbus client
shared contracts, types, and errors
FC1/FC2/FC3/FC4/FC5/FC6/FC15/FC16 frame encode/decode for TCP/RTU/ASCII
serial request queue with priority
polling engine and range merge
Node TCP transport with reconnect
Node UDP transport
browser WebSocket transport with reconnect
typed Electron main/renderer bridge
Electron IPC transport adapter
WebSocket to TCP binary relay gateway
register-value codec helpers
shared async and comparison utilities