I have been talking with one of the developers of SignalK, and he was unable to understand this. I have SignalK boating software running on Docker in Pi 192.168.3.1. Then I have GPSD with a USB GPS mouse on a Pi with the address 192.168.3.2. When I use Bridge mode (which I much prefer, because then I can use port 80 for the SignalK GUI, that does not work in host mode), I can not connect to GPSD. No data comes in, and the GUI says “Connecting” forever. When I use Host mode, it connects at once and all GPS data comes in. This is the Docker Compose file I use for Bridge mode:
services:
signalk-server:
image: cr.signalk.io/signalk/signalk-server:latest
container_name: SignalK
restart: no
ports:
- 80:80
- 1884:1884
network_mode: bridge # (1/3) If bridge-mode is used, then comment line abobe (host) and select/add needed ports settings
devices:
- /dev/ttyUSB0:/dev/ttyUSB0 #Sailor Hat
- /dev/ttyUSB1:/dev/ttyUSB1 #Garmin
volumes:
- /dev:/dev
- /home/pi/Docker-Compose/SignalK/SignalK-data:/home/node/.signalk
entrypoint: sh /home/node/signalk/startup.sh
privileged: true
logging:
options:
max-size: 10m
Is there anything in there that should create any problems? The developer asked me to launch the server like this:
docker run -it --rm --entrypoint /usr/bin/node signalk/signalk-server
And then paste this code:
const socket = require('net').connect(2947, '192.168.3.2', function () {
console.log('Connected')
socket.write("R\r\n")
socket.on("data", function (data) {
console.log("received data")
console.log(data.toString())
socket.end()
})
})
socket.on("error", function (err) {
console.log('Error', err)
})
That errored out:
<ref *1> Error: connect ECONNREFUSED 192.168.3.2:2947
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1606:16)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '192.168.3.2',
port: 2947,
domainEmitter: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_closeAfterHandlingError: false,
_events: {
close: undefined,
error: undefined,
prefinish: undefined,
finish: undefined,
drain: undefined,
data: undefined,
end: [Function: onReadableStreamEnd],
readable: undefined,
connect: [Function]
},
_readableState: ReadableState {
highWaterMark: 16384,
buffer: [],
bufferIndex: 0,
length: 0,
pipes: [],
awaitDrainWriters: null,
[Symbol(kState)]: 1053110,
[Symbol(kErroredValue)]: [Circular *1]
},
_writableState: WritableState {
highWaterMark: 16384,
length: 0,
corked: 0,
onwrite: [Function: bound onwrite],
writelen: 0,
bufferedIndex: 0,
pendingcb: 0,
[Symbol(kState)]: 17564598,
[Symbol(kBufferedValue)]: null,
[Symbol(kErroredValue)]: [Circular *1]
},
allowHalfOpen: false,
_maxListeners: undefined,
_eventsCount: 2,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
[Symbol(async_id_symbol)]: 31,
[Symbol(kHandle)]: null,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: false,
[Symbol(kSetKeepAlive)]: false,
[Symbol(kSetKeepAliveInitialDelay)]: 0,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
domainThrown: false
This way of starting the image:
docker run -it --rm --entrypoint /usr/bin/node --network host signalk/signalk-server
and pasting the same code, did not:
Welcome to Node.js v20.15.0.
Type ".help" for more information.
> const socket = require('net').connect(2947, '192.168.3.2', function () {
... console.log('Connected')
... socket.write("R\r\n")
...
... socket.on("data", function (data) {
... console.log("received data")
... console.log(data.toString())
... socket.end()
... })
... })
undefined
> socket.on("error", function (err) {
... console.log('Error', err)
... })Connected
received data
{"class":"VERSION","release":"3.22","rev":"3.22","proto_major":3,"proto_minor":14}
He ran out of ideas on that. I have no clue. Maybe some of the knowledgeable people here can help?