-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java/ClockStream] Add README File explain the main purpose of ClockS…
…tream and how to launch project
- Loading branch information
1 parent
31a3a8c
commit 7fc24f3
Showing
7 changed files
with
275 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
== About == | ||
Simple app stream clock time using websocket. | ||
|
||
== How To == | ||
git clone https://code.google.com/p/rol3x-place/java/clock-stream/ | ||
mvn jetty:run | ||
|
||
With your browser open http://localhost:8080/clock-webapp/clock_client.html | ||
Open console to view console.log | ||
Enjoy :) | ||
|
||
Ronan-Alexandre Cherrueau | ||
|
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
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
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 |
---|---|---|
@@ -1,5 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Clock Stream WebSocket</title> | ||
<script language="javascript" type="text/javascript"> | ||
var wsUri = "ws://localhost:8080/clock-webapp/clock-stream"; | ||
|
||
function init() { | ||
if (!("WebSocket" in window)) { | ||
console.error("Websockets NOT supported"); | ||
return ; | ||
} | ||
|
||
websocket = new WebSocket(wsUri); | ||
|
||
websocket.onopen = function(evt) { onOpen(evt) }; | ||
websocket.onclose = function(evt) { onClose(evt) }; | ||
websocket.onmessage = function(evt) { onMessage(evt) }; | ||
websocket.onerror = function(evt) { onError(evt) }; | ||
} | ||
|
||
function onOpen(evt) { | ||
console.log("CONNECTED"); | ||
} | ||
|
||
function onClose(evt) { | ||
console.log("DISCONNECTED"); | ||
} | ||
|
||
function onMessage(evt) { | ||
console.log(evt.data); | ||
time = JSON.parse(evt.data); | ||
|
||
// Place current time | ||
document.getElementById("hour").innerHTML = time.hour; | ||
document.getElementById("minute").innerHTML = time.minute; | ||
document.getElementById("second").innerHTML = time.second; | ||
} | ||
|
||
function onError(evt) { | ||
console.error(evt.data); | ||
} | ||
|
||
window.addEventListener("load", init, false); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<h2>Hello World!</h2> | ||
<h2>Clock Stream WebSocket</h2> | ||
<div id="time"> | ||
<span id="hour"></span>:<span id="minute"></span>:<span id="second"></span> | ||
</div> | ||
</body> | ||
</html> |