This repository has been archived on 2021-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
DUT2PTUT/test.html

32 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript">
var messageContainer = document.getElementById("messages");
function WebSocketTest() {
if ("WebSocket" in window) {
messageContainer.innerHTML = "WebSocket is supported by your Browser!";
var ws = new WebSocket("ws://192.168.1.23:80/test/?Id=123456789");
ws.onopen = function() {
ws.send("Message to send");
};
ws.onmessage = function (evt) {
var received_msg = evt.data;
messageContainer.innerHTML = "Message is received...";
};
ws.onclose = function() {
messageContainer.innerHTML = "Connection is closed...";
};
} else {
messageContainer.innerHTML = "WebSocket NOT supported by your Browser!";
}
}
</script>
</head>
<body>
<a href="javascript:WebSocketTest()">Run WebSocket</a>
<div id="messages" style="height:200px;background:black;color:white;"></div>
</body>
</html>