<!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>