-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters