node-gpsd-client
v1.4.1
Published
A nodejs GPSD client library
Downloads
921
Readme
node-gpsd-client
A Nodejs GPSD client
Forked from and heavily inspired by Node GPSD project, with a few little differences:
- GPSD client only
- No builtin logger
- Using message buffer to overcome TCP fragmentation
- Auto reconnect if connection suddently dropped
Usage Example
const Gpsd = require('node-gpsd-client')
const client = new Gpsd({
port: 2947, // default
hostname: 'localhost', // default
parse: true
})
client.on('connected', () => {
console.log('Gpsd connected')
client.watch({
class: 'WATCH',
json: true,
scaled: true
})
})
client.on('error', err => {
console.log(`Gpsd error: ${err.message}`)
})
client.on('TPV', data => {
console.log(data)
})
client.connect()
Options
port
: set GPSD port, defaults to 2947hostname
: set GPSD hostname, defaults to localhostparse
: parse data as JSON objectreconnectThreshold
: max seconds to consider connection is dead since last data received, defaults to 0reconnectInterval
: interval in seconds to detect a connection, defaults to 0
Reconnection will only run when both reconnectThreshold
and reconnectInterval
is greater than 0.
License: MIT