Skip to content

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.

new Tcp(opts): TcpTransport;

Defined in: src/transports/tcpTransport.ts:57

ParameterType
optsTcpTransportOptions

TcpTransport

close(): Promise<void>;

Defined in: src/transports/tcpTransport.ts:117

Destroy the socket and return to idle. Safe to call when never connected.

Promise<void>


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.

Promise<void>


getState(): TransportState;

Defined in: src/transports/tcpTransport.ts:142

TransportState

Transport.getState


onData(cb): void;

Defined in: src/transports/tcpTransport.ts:134

Each chunk is ONE complete companion frame (a BLE notification payload).

ParameterType
cb(chunk) => void

void

Transport.onData


onStateChange(cb): void;

Defined in: src/transports/tcpTransport.ts:138

ParameterType
cb(s) => void

void

Transport.onStateChange


send(bytes): Promise<void>;

Defined in: src/transports/tcpTransport.ts:129

Write one complete companion frame to the radio.

ParameterType
bytesUint8Array

Promise<void>

Transport.send