changeset 82:43da59d50223

Explain API better in README
author Lewin Bormann <lbo@spheniscida.de>
date Sun, 06 Dec 2020 11:03:41 +0100
parents e75a327cca26
children d136dc687455
files README.md assets/livemap.html
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Sat Dec 05 22:23:31 2020 +0100
+++ b/README.md	Sun Dec 06 11:03:41 2020 +0100
@@ -81,7 +81,8 @@
   current working directory from which the server is run.
 * `GET` `/geo/<client>/retrieve/json?secret=<secret>&from=<from_timestamp>&to=<to_timestamp>&limit=<maximum
 number of entries returned>&last=<id of last known entry>`
-  * Fetch geo data as GeoJSON object.
+  * Fetch geo data as GeoJSON object. Returns oldest point first within the
+  returned `GeoJSON` object.
   * `from`, `to`: Timestamp range. For best results, supply ISO 8601 timestamps,
   but `YYYY-mm-dd hh:mm:ss.sss` is also accepted. (GeoHub tries to be flexible
   about this, and may become better over time).
@@ -94,7 +95,11 @@
 * `GET` `/geo/<client>/retrieve/last?secret=<secret>&last=<last ID>&limit=<max
 entries>`
   * Fetch most recent points for the `client`. See `/geo/<client>/retrieve/json`
-  above for descriptions of the other parameters.
+  above for descriptions of the other parameters. As opposed to `retrieve/json`,
+  the returned points are guaranteed to be ordered by time with the newest point
+  first (as makes sense for some use cases), and wrapped inside a `GeoHubUpdate`
+  object containing additional information. This makes the returned value
+  identically structured to that of `retrieve/live` below.
   * Returns a `LiveUpdate` object. `last` is the most-recent ID of all points:
 
 ```json
--- a/assets/livemap.html	Sat Dec 05 22:23:31 2020 +0100
+++ b/assets/livemap.html	Sun Dec 06 11:03:41 2020 +0100
@@ -138,7 +138,9 @@
     // "Go!" was clicked - clear markers and fetch data for new source.
     function buttonGoClicked() {
         clearAllMarkers();
-        lastXHR.abort();
+        if (lastXHR) {
+            lastXHR.abort();
+        }
         updateURL(getClient(), getSecret());
         // Accelerate display.
         backfill();