INTSAMPLES-137: Add WebSockets sample
JIRA: https://jira.spring.io/browse/INTSAMPLES-137 Depends on https://github.com/spring-projects/spring-integration/pull/1274 Polishing and cleanup * Fix `cafe-dsl` project: https://build.spring.io/browse/INTSAMPLES-NIGHTLY-JOB1-1131 * Change author emails to the `pivotal.io` * Regenerate poms Fix for `Cafe-DSL` sample https://build.spring.io/browse/INTSAMPLES-NIGHTLY-JOB1-1143
This commit is contained in:
committed by
Gary Russell
parent
1914a54f3c
commit
a5c12343c6
34
basic/web-sockets/src/main/resources/static/index.html
Normal file
34
basic/web-sockets/src/main/resources/static/index.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Time over WebSocket</title>
|
||||
<script src="http://cdn.sockjs.org/sockjs-0.3.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var sock = new SockJS('http://localhost:8080/time');
|
||||
sock.onopen = function () {
|
||||
document.getElementById('time').innerHTML = 'Connecting...';
|
||||
};
|
||||
sock.onmessage = function (e) {
|
||||
document.getElementById('time').innerHTML = e.data;
|
||||
};
|
||||
sock.onclose = function () {
|
||||
document.getElementById('time').innerHTML = "Server closed connection or hasn't been started";
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body style="margin: 0">
|
||||
<noscript><h2 style="color: #ff0000">Seems your browser doesn't support Javascript!
|
||||
WebSocket relies on Javascript being enabled. Please enable Javascript and reload this page!</h2></noscript>
|
||||
<div id="time"
|
||||
style="position: absolute;
|
||||
bottom: 0;
|
||||
font-size: 800%;
|
||||
height: 200px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
top: 0;
|
||||
width: 100%;">Starting...</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user