blob: 36be61d672d3d643cfefcbf88fa22e272572c9c2 (
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
|
{% 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://{{ 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 %}
|