diff options
| author | 2018-02-13 10:45:57 +0000 | |
|---|---|---|
| committer | 2018-02-13 10:45:57 +0000 | |
| commit | cf999735856504fee0bfe74d9b66e764b71ae746 (patch) | |
| tree | dd08cb6cc372b750732099e42e7f9b9b557d2b28 /templates/ws_test.html | |
| parent | fix typo (diff) | |
Websocket echo test
Diffstat (limited to 'templates/ws_test.html')
| -rw-r--r-- | templates/ws_test.html | 24 | 
1 files changed, 24 insertions, 0 deletions
diff --git a/templates/ws_test.html b/templates/ws_test.html new file mode 100644 index 00000000..fd8dd3a3 --- /dev/null +++ b/templates/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("ws://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 %}
\ No newline at end of file  |