diff options
Diffstat (limited to 'templates/main/ws_test.html')
-rw-r--r-- | templates/main/ws_test.html | 24 |
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 %} |