]> git.sesse.net Git - remoteglot/blobdiff - www/js/remoteglot.js
Add support for delta JSON, to squeeze the request size down further.
[remoteglot] / www / js / remoteglot.js
index b7a4fea4e1f765fc125c365e2f9bbe8b21a9305d..3c85e672e0a66b57bebc8e1a79b1b2f798dc9735 100644 (file)
@@ -138,7 +138,11 @@ var request_update = function() {
                ims = xhr.getResponseHeader('X-Remoteglot-Last-Modified');
                var num_viewers = xhr.getResponseHeader('X-Remoteglot-Num-Viewers');
                possibly_play_sound(current_analysis_data, data);
-               current_analysis_data = data;
+               if (Array.isArray(data)) {
+                       current_analysis_data = JSON_delta.patch(current_analysis_data, data);
+               } else {
+                       current_analysis_data = data;
+               }
                update_board(current_analysis_data, displayed_analysis_data);
                update_num_viewers(num_viewers);