Fix some bugs in dashboard.

- Fixed a null pointer error when Fetching data from the dashboard
  socket when it is first started.
- Lower refresh rate polling the socket for new data to avoid high CPU
  usage.
- Avoid exponentially growing timeouts when reconnecting to the robot.

Change-Id: I7288b27884eafd1ed5c7849cb2a64aad1c0098b1
diff --git a/y2016/dashboard/www/index.html b/y2016/dashboard/www/index.html
index da5512f..3821b48 100644
--- a/y2016/dashboard/www/index.html
+++ b/y2016/dashboard/www/index.html
@@ -7,11 +7,11 @@
 var escapable =
   /[\x00-\x1f\ud800-\udfff\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufff0-\uffff]/g;
 var ws;
-var intervalTime = 50;
+var intervalTime = 100;
 var selected = 0;
 var reconnecting = false;
 var lastSampleID = 0;
-var resetTimeout;
+var reconnectTimeout;
 
 // Filter out junky JSON packets that will otherwise cause nasty decoding
 // errors. These errors come as a result of incomplete packets, corrupted data,
@@ -145,12 +145,13 @@
 }
 
 function reconnect() {
+  clearTimeout(reconnectTimeout);
   $('#message').text('Reconnecting...');
   $('#dataTable').empty();
   lastSampleID = 0;
   reconnecting = true;
 
-  setTimeout(function(){
+  reconnectTimeout = setTimeout(function(){
     initSocketLoop()
   }, 500);
 }