aboutsummaryrefslogtreecommitdiffstats
path: root/templates/main/ws_test.html
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-02-21 09:30:05 +0000
committerGravatar Gareth Coles <[email protected]>2018-02-21 09:30:05 +0000
commitef8e96157f60ba0813cab72a90a6e8e92b44b6f0 (patch)
treecbda21178338d3f992072d5f06e4ac4572e433f1 /templates/main/ws_test.html
parentadds initial unit testing (#22) (diff)
Rearrange views and templates
Diffstat (limited to 'templates/main/ws_test.html')
-rw-r--r--templates/main/ws_test.html24
1 files changed, 24 insertions, 0 deletions
diff --git a/templates/main/ws_test.html b/templates/main/ws_test.html
new file mode 100644
index 00000000..6ef1bb68
--- /dev/null
+++ b/templates/main/ws_test.html
@@ -0,0 +1,24 @@
+{% extends "base.html" %}
+{% block title %}WS Test{% endblock %}
+{% block content %}
+ <div class="uk-container uk-section">
+ <h1>Open your JS console to test</h1>
+
+ <script type="application/javascript">
+ let ws = new WebSocket("wss://api.{{ server_name }}/ws/echo");
+
+ ws.onopen = function(event) {
+ console.log("WS opened! Use send() to send a message.");
+ };
+
+ ws.onmessage = function (event) {
+ console.log("<- " + event.data);
+ };
+
+ function send(text) {
+ console.log("-> " + text);
+ ws.send(text);
+ }
+ </script>
+ </div>
+{% endblock %}