Initial sketch of the GUI web-socket mechanics.

Change-Id: I5f481886fd45ce058be4aaf07fba466e702ae7ad
diff --git a/web/gui/src/main/webapp/topo2.js b/web/gui/src/main/webapp/topo2.js
index d345fda..e7444c9 100644
--- a/web/gui/src/main/webapp/topo2.js
+++ b/web/gui/src/main/webapp/topo2.js
@@ -40,6 +40,7 @@
             showBackground: true
         },
         backgroundUrl: 'img/us-map.png',
+        webSockUrl: 'ws/topology',
         data: {
             live: {
                 jsonUrl: 'rs/topology/graph',
@@ -130,6 +131,7 @@
             links: [],
             lookup: {}
         },
+        webSock,
         labelIdx = 0,
         selected = {},
         highlighted = null,
@@ -579,6 +581,52 @@
     }
 
     // ==============================
+    // Web-Socket for live data
+
+    function webSockUrl() {
+        return document.location.toString()
+            .replace(/\#.*/, '')
+            .replace('http://', 'ws://')
+            .replace('https://', 'wss://')
+            .replace('index2.html', config.webSockUrl);
+    }
+
+    webSock = {
+        ws : null,
+
+        connect : function() {
+            webSock.ws = new WebSocket(webSockUrl());
+
+            webSock.ws.onopen = function() {
+                webSock._send("Hi there!");
+            };
+
+            webSock.ws.onmessage = function(m) {
+                if (m.data) {
+                    console.log(m.data);
+                }
+            };
+
+            webSock.ws.onclose = function(m) {
+                webSock.ws = null;
+            };
+        },
+
+        send : function(text) {
+            if (text != null && text.length > 0) {
+                webSock._send(text);
+            }
+        },
+
+        _send : function(message) {
+            if (webSock.ws) {
+                webSock.ws.send(message);
+            }
+        }
+
+    };
+
+    // ==============================
     // View life-cycle callbacks
 
     function preload(view, ctx) {
@@ -656,6 +704,7 @@
             .on('tick', tick);
 
         network.drag = d3u.createDragBehavior(network.force, selectCb, atDragEnd);
+        webSock.connect();
     }
 
     function load(view, ctx) {