mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 21:07:26 +02:00
committed by
Damian Jarek
parent
86176786c3
commit
e5bad9cbc2
@ -5,6 +5,7 @@ Version 256:
|
||||
* Remove redundant use of `static_string`
|
||||
* Remove redundant template in service_base
|
||||
* Expand CI matrix using Azure Pipelines
|
||||
* Make chat websocket javascript client more user friendly
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@ -14,9 +14,7 @@
|
||||
<button class="echo-button" id="connect">Connect</button>
|
||||
<button class="echo-button" id="disconnect">Disconnect</button><br>
|
||||
Your Name: <input class="draw-border" id="userName" size=47 style="margin-bottom: 5px;"><br>
|
||||
|
||||
<pre id="messages" style="width: 600px; height: 400px; border: solid 1px #cccccc; margin-bottom: 5px;"></pre>
|
||||
|
||||
<pre id="messages" style="width: 600px; height: 400px; white-space: normal; overflow: auto; border: solid 1px #cccccc; margin-bottom: 5px;"></pre>
|
||||
<div style="margin-bottom: 5px;">
|
||||
Message<br>
|
||||
<input class="draw-border" id="sendMessage" size="74" value="">
|
||||
@ -24,20 +22,23 @@
|
||||
</div>
|
||||
<script>
|
||||
var ws = null;
|
||||
|
||||
function showMessage(msg) {
|
||||
messages.innerText += msg + "\n";
|
||||
messages.scrollTop = messages.scrollHeight - messages.clientHeight;
|
||||
};
|
||||
connect.onclick = function() {
|
||||
ws = new WebSocket(uri.value);
|
||||
ws.onopen = function(ev) {
|
||||
messages.innerText += "[connection opened]\n";
|
||||
showMessage("[connection opened]");
|
||||
};
|
||||
ws.onclose = function(ev) {
|
||||
messages.innerText += "[connection closed]\n";
|
||||
showMessage("[connection closed]");
|
||||
};
|
||||
ws.onmessage = function(ev) {
|
||||
messages.innerText += ev.data + "\n";
|
||||
showMessage(ev.data);
|
||||
};
|
||||
ws.onerror = function(ev) {
|
||||
messages.innerText += "[error]\n";
|
||||
showMessage("[error]");
|
||||
console.log(ev);
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user