@modbus-ts/transport-ws
v0.0.5
Published
The transport-ws package for modbus-ts.
Maintainers
Readme
@modbus-ts/transport-ws
Browser WebSocket transport adapter for Modbus traffic.
Installation
pnpm add @modbus-ts/transport-wsCore Exports
- WsTransportOptions
- WsTransport
Minimal Example
import { WsTransport } from '@modbus-ts/transport-ws'
const transport = new WsTransport({
url: 'ws://127.0.0.1:18080',
reconnectDelayMs: 300,
maxReconnectDelayMs: 5000,
})
await transport.connect()
await transport.send(new Uint8Array([0, 1, 0, 0, 0, 6, 1, 3, 0, 0, 0, 1]))Behavior
- Buffers and reassembles MBAP-based frames
- Automatic reconnect with exponential backoff
- Designed for browser to gateway communication
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
