Initial sketch of the GUI web-socket mechanics.
Change-Id: I5f481886fd45ce058be4aaf07fba466e702ae7ad
diff --git a/web/gui/src/main/webapp/ws.html b/web/gui/src/main/webapp/ws.html
new file mode 100644
index 0000000..cac99b2
--- /dev/null
+++ b/web/gui/src/main/webapp/ws.html
@@ -0,0 +1,54 @@
+<html>
+<head>
+ <title>Web Sockets Demo</title>
+
+ <script src="libs/jquery-2.1.1.min.js"></script>
+
+ <script type='text/javascript'>
+ if (!window.WebSocket)
+ alert("WebSocket not supported by this browser");
+
+ var server = {
+ connect : function() {
+ var location = document.location.toString().replace('http://',
+ 'ws://').replace('https://', 'wss://').replace('ws.html','ws/topology');
+ this.ws = new WebSocket(location);
+
+ this.ws.onopen = function() {
+ server._send("Hi there!");
+ };
+
+ this.ws.onmessage = function(m) {
+ if (m.data) {
+ $('#log').append(m.data).append($('<br/>'));
+ }
+ };
+
+ this.ws.onclose = function(m) {
+ this.ws = null;
+ };
+ },
+
+ _send : function(message) {
+ if (this.ws) {
+ this.ws.send(message);
+ }
+ },
+
+ send : function(text) {
+ if (text != null && text.length > 0) {
+ server._send(text);
+ }
+ }
+ };
+ </script>
+</head>
+<body>
+<pre id='log'></pre>
+
+<script type='text/javascript'>
+ server.connect();
+</script>
+
+</body>
+</html>