-
-
Save baptistemanson/0a5940df48c4d3af8e94eab7dbbe6ba8 to your computer and use it in GitHub Desktop.
{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"$id": "http://shone.com/anorak.json", | |
"title": "Anorak", | |
"description": "Portable Realtime Maritime Navigational Data Protocol", | |
"oneOf": [ | |
{ "$ref": "#subscribeMessage" }, | |
{ "$ref": "#unsubscribeMessage" }, | |
{ "$ref": "#getMessage" }, | |
{ "$ref": "#deltaMessage" }, | |
{ "$ref": "#fullMessage" } | |
], | |
"definitions": { | |
"mmsi": { | |
"$id": "#mmsi", | |
"description": "The vessel unique identifier", | |
"type": "string" | |
}, | |
"source": { | |
"$id": "#source", | |
"description": "One apparatus measuring facts on a vessel", | |
"type": "string", | |
"enum": [ | |
"gps", | |
"ecdis", | |
"radar", | |
"compas", | |
"dopplerspeedlog", | |
"depthsounder", | |
"ais", | |
"autopilot", | |
"bnwas", | |
"steeringgear" | |
] | |
}, | |
"singleDelta": { | |
"$id": "#singleDelta", | |
"description": "One single delta message", | |
"type": "object" | |
}, | |
"subscribeMessage": { | |
"$id": "#subscribeMessage", | |
"description": "Request to start receiving delta updates", | |
"type": "object", | |
"properties": { | |
"op": { | |
"type": "string", | |
"const": "subscribe" | |
}, | |
"mmsi": { "$ref": "#mmsi" }, | |
"source": { "$ref": "#source" } | |
} | |
}, | |
"unsubscribeMessage": { | |
"$id": "#unsubscribeMessage", | |
"description": "Request to stop receiving delta updates", | |
"type": "object", | |
"properties": { | |
"op": { | |
"type": "string", | |
"const": "unsubscribe" | |
}, | |
"mmsi": { "$ref": "#mmsi" }, | |
"source": { "$ref": "#source" } | |
} | |
}, | |
"getMessage": { | |
"$id": "#getMessage", | |
"description": "Request to get a full state update", | |
"type": "object", | |
"properties": { | |
"op": { | |
"type": "string", | |
"const": "get" | |
}, | |
"mmsi": { "$ref": "#mmsi" }, | |
"source": { "$ref": "#source" } | |
} | |
}, | |
"deltaMessage": { | |
"$id": "#deltaMessage", | |
"type": "object", | |
"description": "A delta update", | |
"properties": { | |
"op": { | |
"type": "string", | |
"const": "delta" | |
}, | |
"mmsi": { "$ref": "#mmsi" }, | |
"source": { "$ref": "#source" }, | |
"delta": { | |
"type": "array", | |
"minItems": 1, | |
"items": { "$ref": "#singleDelta" } | |
} | |
} | |
}, | |
"fullMessage": { | |
"$id": "#fullMessage", | |
"description": "A full state update", | |
"type": "object", | |
"properties": { | |
"op": { | |
"type": "string", | |
"const": "full", | |
"mmsi": { "$ref": "#mmsi" }, | |
"source": { "$ref": "#source" }, | |
"full": { | |
"type": "array", | |
"minItems": 1, | |
"items": { "$ref": "#singleDelta" } | |
} | |
} | |
} | |
} | |
} | |
} |
Get is to request a full state. Full is the response. Subscribe is to request to start receiving delta updates, and delta is one of those updates.
I updated the gist to comment it out.
Ok thanks @baptistemanson
Updated with the new sources @azouz provided.
Corrected the typo on compass.
How would the full state work exactly ? From what I see it is an array of delta updates. Is this easily streamable ? I think one of the key points you mentioned during the meeting @baptistemanson was the ability to stream the full state instead of having to parse a large json object as is the case with SignalK for instance. In this case, would we split the full state in multiple messages to stream by batches of N delta updates ? If so should we add a pagination parameter ?
That's good. What is the purpose of get vs full and delta though ?