Last active
January 29, 2019 20:02
-
-
Save baptistemanson/0a5940df48c4d3af8e94eab7dbbe6ba8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$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" } | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 ?