From c306b45d89dc3d05ec703fcc97848497e799a80a Mon Sep 17 00:00:00 2001 From: richo Date: Tue, 25 Dec 2012 18:28:53 +1100 Subject: [PATCH] Update the protocol document with details of the transfer protocol --- PROTOCOL.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/PROTOCOL.md b/PROTOCOL.md index cbd0dd3..a32fb8e 100644 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -20,3 +20,36 @@ Protocol Specification for groundstation * stationd shall implement a notification type to allow clients (web ui, native etc) to be notified immediately of new data. +## Transfer of data + +* Data is requested by sending a serialized hash, with the keys: + +```javascript +{ + "type": REQUEST, + "request": KEYWORD, // KEYWORDs include LISTALLOBJECTS FETCHOBJECT + "id": UUID // UUID shall be a uuid to marry up with the response +} +``` + +* Data shall be replied to with a similar hash, + +```javascript +{ + "type": RESPONSE, + "phrase": KEYWORD, // KEYWORDs include TRANSFER and TERMINATE. more than a + // single response is valid for a request, TERMINATE + // signifies that the storage allocated to the request + // may be freed + "id": UUID, // The UUID sent with the request. In the case + "payload": PAYLOAD // The payload associated with the request. request type specific. +} +``` + +* When a connection is initialized, the recieving node will check if it already + has a connection to the given party and sever it in that case. +* Should the connection not be severed, the connecting party shall immediately + issue a `LISTALLOBJECTS` request. This will essentially kick off the event + loop, at this point all requests can be responded to in kind as a result of + the ordinary event loop without outside interference. +