What
The Signal K server marks a path's metadata as sent to a WebSocket client before checking whether the metadata lookup returned anything. In src/interfaces/ws.ts, handleValuesMeta sets spark.sentMetaData[partialContextPathKey] = true and then calls getMetadata(...).
The registry behind that lookup gains entries at runtime — addMetaData in @signalk/path-metadata is called as meta deltas are received. So a producer that emits a path's value before registering its metadata permanently costs that connection the metadata: the client is recorded as having been told, and the server never revisits it. @signalk/course-provider does exactly this, sending the navigation.course.calcValues.* values before the meta delta.
A page reload clears it, because spark.sentMetaData starts empty on a new connection. That is why the symptom in #545 looked intermittent.
Why this is filed here
SignalK/signalk-server is a third-party repository, so reporting it upstream needs an explicit decision rather than being done as a side effect of our own fix. This issue exists so the finding is not lost, and so the workaround in #579 has something to point at.
What we did instead
#579 fetches the path's metadata over the v1 REST API, which re-reads the registry per request and is therefore still able to answer. That is a workaround: it costs up to three requests per affected path per connection, and it cannot help a client that is not Skip.
Next step
Decide whether to report this upstream. Moving the sentMetaData assignment after a successful lookup looks like the whole fix, but the server's own test coverage and any client relying on the current behaviour would need checking first.
What
The Signal K server marks a path's metadata as sent to a WebSocket client before checking whether the metadata lookup returned anything. In
src/interfaces/ws.ts,handleValuesMetasetsspark.sentMetaData[partialContextPathKey] = trueand then callsgetMetadata(...).The registry behind that lookup gains entries at runtime —
addMetaDatain@signalk/path-metadatais called as meta deltas are received. So a producer that emits a path's value before registering its metadata permanently costs that connection the metadata: the client is recorded as having been told, and the server never revisits it.@signalk/course-providerdoes exactly this, sending thenavigation.course.calcValues.*values before the meta delta.A page reload clears it, because
spark.sentMetaDatastarts empty on a new connection. That is why the symptom in #545 looked intermittent.Why this is filed here
SignalK/signalk-serveris a third-party repository, so reporting it upstream needs an explicit decision rather than being done as a side effect of our own fix. This issue exists so the finding is not lost, and so the workaround in #579 has something to point at.What we did instead
#579 fetches the path's metadata over the v1 REST API, which re-reads the registry per request and is therefore still able to answer. That is a workaround: it costs up to three requests per affected path per connection, and it cannot help a client that is not Skip.
Next step
Decide whether to report this upstream. Moving the
sentMetaDataassignment after a successful lookup looks like the whole fix, but the server's own test coverage and any client relying on the current behaviour would need checking first.