1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-01-30 14:13:07 +01:00
CommandStation-EX/Release_Notes/websocketTester.html
Asbelos 07691e3985 Squashed commit of the following:
commit 04b8e20773
Author: Asbelos <asbelos@btinternet.com>
Date:   Sat Jan 18 10:13:32 2025 +0000

    Fix websocket binary mask issue

    Includes <D WEBSOCKET ON>

commit 5600382ae4
Merge: 5941866 137008c
Author: Asbelos <asbelos@btinternet.com>
Date:   Sat Jan 18 08:58:30 2025 +0000

    Merge branch 'devel' into devel-websockets

commit 59418668e2
Author: Asbelos <asbelos@btinternet.com>
Date:   Fri Jan 17 13:16:29 2025 +0000

    WIfiESP websock fix

commit c4e2146bd1
Author: Asbelos <asbelos@btinternet.com>
Date:   Thu Jan 16 08:37:38 2025 +0000

    websockets broadcast

commit 2591d100ca
Author: Asbelos <asbelos@btinternet.com>
Date:   Wed Jan 15 19:38:41 2025 +0000

    browser barf on \n

commit 67f836e886
Author: Asbelos <asbelos@btinternet.com>
Date:   Wed Jan 15 09:44:04 2025 +0000

    5.5.5 + websockets

    Ethernet not yet included
2025-01-23 10:46:39 +00:00

41 lines
1.2 KiB
HTML

<html>
<!-- Minimalist test page for the DCCEX websocket API.-->
<head>
<script>
let socket = new WebSocket("ws://192.168.1.242:2560","DCCEX");
// send message from the form
var sender = function() {
var msg=document.getElementById('message').value;
socket.send(msg);
}
// message received - show the message in div#messages
socket.onmessage = function(event) {
let message = event.data;
let messageElem = document.createElement('div');
messageElem.textContent = message;
document.getElementById('messages').prepend(messageElem);
}
socket.onerror = function(event) {
let message = event.data;
let messageElem = document.createElement('div');
messageElem.textContent = message;
document.getElementById('messages').prepend(messageElem);
}
</script>
</head>
<body>
This is a minimalist test page for the DCCEX websocket API.
It demonstrates the Websocket connection and how to send
or receive websocket traffic.
The connection string must be edited to address your command station
correctly.<p>
<!-- message form -->
<input type="text" id="message">
<input type="button" value="Send" onclick="sender();">
<!-- div with messages -->
<div id="messages"></div>
</body>
</html>