blob: 64a7dfc4a45d4abdb0616e03d3c76ba022cee006 (
plain) (
blame)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 | {% extends "main/base.html" %}
{% block title %}WS Test{% endblock %}
{% block og_title %}WS Test{% endblock %}
{% block og_description %}A test page for our Websockets implementation{% 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 %}
 |