bunti/bunti_server/src/main/webapp/index.jsp

59 lines
1.6 KiB
Plaintext

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WebSockets</title>
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
<link type="text/css" href="css/screen.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript">
var ws;
$(document).ready(
function() {
ws = new MozWebSocket("ws://localhost:8080/bunti_server/dmx");
//ws = new MozWebSocket("ws://localhost:8080/grizzly-websockets-chat/chat");
ws.onmessage = function (message) {
$("#messages").append("<p>" + message.data + "</p>");
};
ws.onopen = function () {
$("#messages").append("<p>WS opened</p>");
};
ws.onclose = function () {
$("#messages").append("<p>WS closed</p>");
};
});
</script>
</head>
<body>
<h1>Hello World!</h1>
<script>
$(function() {
$("#slider").slider({ slide: function(event, ui) {
ws.send("channel:2=" + ui.value);
} });
});
</script>
<div class="demo">
<div id="slider"></div>
</div>
<div id="messages"></div>
</body>
</html>