Open bdbcat opened 4 years ago
You may need an *
eg (pretty print for clarity, send as single line)
`{
"context": "vessels.", <<< HERE
"subscribe": [
{
"path": "navigation" <<< Also try a wider path. You may not have any 'course' data
}
]
}
Check you are actually sending, and you may need to end the message with [CR/LF] which marks end of message over tcp.
The specification talks explicitly about using wildcards, so I believe the subcription for all values with prefix navigation
should be "path": "navigation.*"
.
I think it is high time we revisit the Signal K over tcp / bytestream
and specify the message delimiter.
rob42... Working now. The "missing *" characters were actually in my code, just fell out of the cut/paste. The key was missing delimiter. I found that "\n" worked OK. Could not find any reference to delimiters in sk specification. Thanks Dave
Correction to above. Required message delimiter is "\r\n", or CR\LF. Dave
Rob42...
I am the Lead Dev for OpenCPN. As an experiment, I am adapting OCPN for basic SK/JSON message processing, planning to use direct TCP connection to a signalk-java server accessible to the system.
I am using a serial port NMEA input connection to the server, which is monitored and reported correctly by the REST API, available on the server management interface.
From my OCPN client I create a TCP socket to the remote server at port 55555 (the default). The socket connects OK, and I get a nice "welcome" response from the server. I then attempt to subscribe to some data by simply sending the following JSON message down the socket:
c++ code: char sub2[] = "{\"context\":\"vessels.\",\"subscribe\":[{\"path\":\"navigation.course\"}]}"; GetSock()->Write(sub2, strlen(sub2));
No error on the write. But nothing ever comes back from the server.
What am I missing? Thanks Dave