Tcp
Defined in: src/transports/tcpTransport.ts:46
Complete, batteries-included TCP transport for the MeshCore companion
protocol. Unlike Serial/BLE (which are bring-your-own-driver adapters), TCP’s
only driver is the node:net builtin, so this transport owns its socket and
its connect/close lifecycle. The wire framing is identical to serial
([0x3c]/[0x3e][uint16 LE length][payload]), so it reuses
SerialDeframer + encodeSerialFrame rather than reimplementing framing.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Tcp(opts): TcpTransport;Defined in: src/transports/tcpTransport.ts:57
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
opts | TcpTransportOptions |
Returns
Section titled “Returns”TcpTransport
Methods
Section titled “Methods”close()
Section titled “close()”close(): Promise<void>;Defined in: src/transports/tcpTransport.ts:117
Destroy the socket and return to idle. Safe to call when never connected.
Returns
Section titled “Returns”Promise<void>
connect()
Section titled “connect()”connect(): Promise<void>;Defined in: src/transports/tcpTransport.ts:69
Dial host:port. Resolves on the socket’s ‘connect’ event, rejects on a socket ‘error’ or if no connection completes within connectTimeoutMs.
Returns
Section titled “Returns”Promise<void>
getState()
Section titled “getState()”getState(): TransportState;Defined in: src/transports/tcpTransport.ts:142
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”onData()
Section titled “onData()”onData(cb): void;Defined in: src/transports/tcpTransport.ts:134
Each chunk is ONE complete companion frame (a BLE notification payload).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cb | (chunk) => void |
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”onStateChange()
Section titled “onStateChange()”onStateChange(cb): void;Defined in: src/transports/tcpTransport.ts:138
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cb | (s) => void |
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”send()
Section titled “send()”send(bytes): Promise<void>;Defined in: src/transports/tcpTransport.ts:129
Write one complete companion frame to the radio.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
bytes | Uint8Array |
Returns
Section titled “Returns”Promise<void>