summaryrefslogtreecommitdiff
path: root/web-static/socket.html
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-09-24 18:48:29 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-09-24 18:48:29 (GMT)
commit2de6beb14b764a850933040c8970dedfd78158c8 (patch)
treedf7d523a1406e5b0cadec7dce8455b04e59a21e6 /web-static/socket.html
parentcb045546348fb04173d84e7c700f8674fbe1797c (diff)
added support for web-socket based interface
Diffstat (limited to 'web-static/socket.html')
-rw-r--r--web-static/socket.html76
1 files changed, 76 insertions, 0 deletions
diff --git a/web-static/socket.html b/web-static/socket.html
new file mode 100644
index 0000000..fa20146
--- /dev/null
+++ b/web-static/socket.html
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>rhctl Websocket Testclient</title>
+ <meta charset="utf-8">
+ <style type="text/css">
+ body {
+ background-color: #555;
+ }
+
+ div.data {
+ background-color: white;
+ border: 1px solid;
+ padding: 1em;
+ font-family: monospace;
+ margin-top: 1em;
+ margin-bottom: 1em;
+ }
+
+ #progress {
+ background-color: white;
+ border: 1px solid;
+ padding: 1em;
+ font-family: monospace;
+ margin-top: 2em;
+ margin-bottom: 0em;
+ }
+
+ #progress span.caption {
+ font-weight: bold;
+ }
+
+ td {
+ text-align: right;
+ }
+ </style>
+ <script src="jquery.min.js"></script>
+ <script type="text/javascript">
+ function State(req) {
+ this.req = req
+ this.sock = new WebSocket("ws://localhost:4080/socket");
+ this.sock_onmessage = function (event) {
+ $('#statemsg').text(event.data);
+ }
+ this.sock.onmessage = this.sock_onmessage.bind(this);
+
+ this.sock_onopen = function() {
+ this.sock.send(JSON.stringify(this.req));
+ $('#buttonstate').attr('disabled','disabled')
+ }
+ this.sock.onopen = this.sock_onopen.bind(this);
+ }
+
+ var s;
+
+ function state() {
+ req = { COMMAND: "state" };
+ s = new State(req);
+ }
+
+ function init() {
+ $('#buttonstate').removeAttr('disabled','disabled');
+ }
+ </script>
+ </head>
+ <body onload="init()">
+
+ <h1>rhctl Websocket Testclient</h1>
+
+ <div>
+ <button id="buttonstate" onclick="state()">get state</button>
+ <div id="statemsg" class="data"></div>
+ </div>
+
+ </body>
+</html>