NtripClient

NtripClient - Handles connections to NTRIP casters for RTK corrections with multiple connection approaches (direct, proxy, WebSocket)

Constructor

new NtripClient(eventEmitter, options)

Create a new NTRIP client

Parameters:
NameTypeDescription
eventEmitterObject

Event emitter for communication

optionsObject

Configuration options

Classes

NtripClient

Methods

(async) connect(config) → {Promise.<boolean>}

Connect to NTRIP caster using the configured method

Parameters:
NameTypeDescription
configObject

Connection configuration

Returns:

Whether connection was successful

Type: 
Promise.<boolean>

(async) connectDirect() → {Promise.<boolean>}

Connect directly to NTRIP caster

Returns:

Whether connection was successful

Type: 
Promise.<boolean>

(async) connectProxy() → {Promise.<boolean>}

Connect to NTRIP caster via HTTP proxy

Returns:

Whether connection was successful

Type: 
Promise.<boolean>

(async) connectWebSocket() → {Promise.<boolean>}

Connect to NTRIP caster using WebSocket to proxy

Returns:

Whether connection was successful

Type: 
Promise.<boolean>

createGgaSentence(position) → {string}

Create NMEA GGA sentence from position data

Parameters:
NameTypeDescription
positionObject

Position data

Returns:

GGA sentence

Type: 
string

disconnect()

Disconnect from NTRIP caster

forwardRtcmToDevice(data)

Forward RTCM data to connected device

Parameters:
NameTypeDescription
dataArrayBuffer

RTCM binary data to forward

getConnectionInfo() → {Object}

Get connection status information

Returns:

Connection status

Type: 
Object

getRtcmStats() → {Object}

Get RTCM statistics

Returns:

RTCM statistics

Type: 
Object

handleDisconnect(event)

Handle disconnection (either manual or due to error)

Parameters:
NameTypeDescription
eventObject

Disconnection event info

(async) handleRtcmData(data)

Handle binary RTCM data from WebSocket

Parameters:
NameTypeDescription
dataArrayBuffer | Blob

RTCM data

handleSocketClose(event)

Handle WebSocket close event

Parameters:
NameTypeDescription
eventCloseEvent

WebSocket close event

handleSocketError(event)

Handle WebSocket error event

Parameters:
NameTypeDescription
eventEvent

WebSocket error event

handleSocketMessage(event)

Handle WebSocket message (for WebSocket mode)

Parameters:
NameTypeDescription
eventMessageEvent

WebSocket message event

isValidGga(sentence) → {boolean}

Validate if a GGA sentence is properly formatted

Parameters:
NameTypeDescription
sentencestring

GGA sentence to validate

Returns:

Whether the sentence is valid

Type: 
boolean

isValidRtcmData(data) → {boolean}

Validate if the data is in RTCM3 format

Parameters:
NameTypeDescription
dataArrayBuffer

Binary data to validate

Returns:

Whether the data appears to be valid RTCM3

Type: 
boolean

(async) processRtcmQueue()

Process the queue of RTCM messages

(async) readStream()

Read and process the response stream from the NTRIP caster (for direct/proxy mode)

resetRtcmStats()

Reset RTCM statistics

scheduleReconnect()

Schedule a reconnection attempt

(async) sendGGA(gga) → {Promise.<boolean>}

Send NMEA GGA sentence to NTRIP caster

Parameters:
NameTypeDescription
ggastring

NMEA GGA sentence

Returns:

Whether message was sent successfully

Type: 
Promise.<boolean>

(async) sendGGADirect(gga) → {Promise.<boolean>}

Send GGA directly to NTRIP caster

Parameters:
NameTypeDescription
ggastring

NMEA GGA sentence

Returns:

Whether message was sent successfully

Type: 
Promise.<boolean>

(async) sendGGAProxy(gga) → {Promise.<boolean>}

Send GGA via proxy

Parameters:
NameTypeDescription
ggastring

NMEA GGA sentence

Returns:

Whether message was sent successfully

Type: 
Promise.<boolean>

(async) sendGGAWebSocket(gga) → {Promise.<boolean>}

Send GGA via WebSocket

Parameters:
NameTypeDescription
ggastring

NMEA GGA sentence

Returns:

Whether message was sent successfully

Type: 
Promise.<boolean>

setAutoReconnect(enabled, maxAttempts)

Enable/disable auto-reconnect

Parameters:
NameTypeDefaultDescription
enabledboolean

Whether auto-reconnect is enabled

maxAttemptsnumber5

Maximum reconnection attempts

setDeviceManager(deviceManager)

Set the device manager for sending corrections

Parameters:
NameTypeDescription
deviceManagerObject

ConnectionManager or BluetoothManager

setGgaUpdateInterval(seconds)

Set the GGA update interval

Parameters:
NameTypeDescription
secondsnumber

Update interval in seconds

startGgaUpdates()

Start periodically sending GGA updates to the NTRIP caster

stopGgaUpdates()

Stop sending GGA updates

updateCorrectionAge()

Update correction age based on last message time

updatePosition(position)

Update the device with the latest position

Parameters:
NameTypeDescription
positionObject

Position data