Skip to content

Commit de83f65

Browse files
bkp7sbender9
authored andcommitted
docs: modify re meta deltas (#491)
1 parent fb2bf21 commit de83f65

File tree

3 files changed

+53
-11
lines changed

3 files changed

+53
-11
lines changed

gitbook-docs/data_model.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ transmitted as UTF-8 JSON.
88
## Full Format
99

1010
The full format is conceptually the simplest representation of data in Signal K. It contains all of the data from a
11-
Signal K node, which in the case of a Signal K server could me many hundreds of data points.
11+
Signal K node, which in the case of a Signal K server could be many hundreds of data points.
1212

1313
[>]: # (mdpInsert ```json fsnip ../samples/full/docs-data_model.json)
1414
```json
@@ -263,32 +263,42 @@ the value should be merged to the full model mounted where the delta‘s context
263263
]
264264
}
265265
```
266+
[<]: #
266267
## Delta Format For Metadata
267268

268-
Metadata can also be specified via a delta. The delta is very similiar to the `values` deltas above, but instead of having `values` key, it will have a `meta` key. Note that a client could multiple meta deltas for any given path from different sources, so the client merge the meta information.
269+
Metadata can also be updated via a delta within the `meta` key.
270+
271+
Since meta data is not often updated it is only sent when there has been a change. See [Subscription Protocol](subscription_protocol.md) for details.
269272

273+
[>]: # (mdpInsert ```json fsnip ../samples/delta/docs-data_model_meta_deltas.json --prettify 2 20)
270274
```json
271275
{
272276
"context": "vessels.urn:mrn:imo:mmsi:234567890",
273277
"updates": [
274278
{
275-
"source": {...},
276279
"timestamp": "2014-08-15T19:02:31.507Z",
277-
"meta":[
280+
"meta": [
278281
{
279282
"path": "environment.wind.speedApparent",
280-
"value":
281-
{
282-
"units": "m/s",
283-
"description": "Apparent wind speed"
284-
}
283+
"value": {
284+
"units": "m/s",
285+
"description": "Apparent wind speed",
286+
"displayName": "Apparent Wind Speed",
287+
"shortName": "AWS",
288+
"zones": [
289+
{
290+
"upper": 15.4333,
291+
"state": "warn",
292+
"message": "high wind speed"
293+
}
294+
]
295+
}
285296
}
286297
]
287298
}
288299
]
289300
}
290301
```
291-
292302
[<]: #
293303
## Data Quality
294304

gitbook-docs/subscription_protocol.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The following are optional, included above only for example as it uses defaults
8686

8787
* `period=[millisecs]` becomes the transmission rate, e.g. every `period/1000` seconds. Default: 1000
8888
* `format=[delta|full]` specifies delta or full format. Default: delta
89-
* `policy=[instant|ideal|fixed]`. Default: ideal
89+
* `policy=[instant|ideal|fixed]`. Default: ideal. (does not apply to meta - see below)
9090
* `instant` means send all changes as fast as they are received, but no faster than `minPeriod`. With this policy the
9191
client has an immediate copy of the current state of the server.
9292
* `ideal` means use `instant` policy, but if no changes are received before `period`, then resend the last known
@@ -101,6 +101,13 @@ duplication as it prefers on a per connection basis. At the same time it is good
101101
connections necessary, for instance one WebSocket connection shared between an instrument panel with many gauges,
102102
rather then one WebSocket connection per gauge.
103103

104+
## Meta data
105+
Meta is updated via the `meta` section within the delta message. As meta changes infrequently it is only sent when it has changed.
106+
107+
Servers implementing the subscription model (ie. using deltas) SHOULD implement meta deltas. Where meta deltas are implemented, servers MUST only ever send full copies of the meta for a leaf, ie. they MUST NEVER send a partial meta.
108+
109+
Upon receiving a new subscription a server MUST send the meta for each leaf subscribed to; this MAY be in the same JSON document as the values, or in a separate one prior to sending values for that leaf or leaves. Subsequently the server MUST resend the full meta for a leaf each time any item in that meta is changed. This is equivalent to the `instant` subscription for values. Therefore meta is never subscribed on an `ideal` or `fixed` policy, irrespective of the policy requested by the consumer (which applies to values only).
110+
104111
## Multiple value handling in subscriptions
105112

106113
A subscription to a key is for all the updates to that key. If there are multiple sources generating data for that key
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"context": "vessels.urn:mrn:imo:mmsi:234567890",
3+
"updates": [
4+
{
5+
"timestamp": "2014-08-15T19:02:31.507Z",
6+
"meta": [
7+
{
8+
"path": "environment.wind.speedApparent",
9+
"value": {
10+
"units": "m/s",
11+
"description": "Apparent wind speed",
12+
"displayName": "Apparent Wind Speed",
13+
"shortName": "AWS",
14+
"zones": [{
15+
"upper": 15.4333,
16+
"state": "warn",
17+
"message": "high wind speed"
18+
}
19+
]
20+
}
21+
}
22+
]
23+
}
24+
]
25+
}

0 commit comments

Comments
 (0)