Browse Source

Updated htmls to use conneciton.js

master
Joshua Moerman 12 years ago
parent
commit
b1bf2f8088
  1. 3
      index.html
  2. 4
      observer.html

3
index.html

@ -1,6 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>WebSocket Test</title> <title>WebSocket Test</title>
<script type="text/javascript" src="connection.js"></script>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
var myName = Math.random().toString(36).substring(7); var myName = Math.random().toString(36).substring(7);
var websocket; var websocket;
@ -16,7 +17,7 @@
testWebSocket(); testWebSocket();
} }
function testWebSocket() { function testWebSocket() {
websocket = new WebSocket("ws://127.0.0.1:7681"); websocket = new WebSocket(wsURI);
websocket.onopen = function (evt) { onOpen(evt) }; websocket.onopen = function (evt) { onOpen(evt) };
websocket.onclose = function (evt) { onClose(evt) }; websocket.onclose = function (evt) { onClose(evt) };
websocket.onmessage = function (evt) { onMessage(evt) }; websocket.onmessage = function (evt) { onMessage(evt) };

4
observer.html

@ -25,6 +25,7 @@
background-color: #0af; background-color: #0af;
} }
</style> </style>
<script type="text/javascript" src="connection.js"></script>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
var websocket; var websocket;
var the_screen; var the_screen;
@ -34,7 +35,7 @@
testWebSocket(); testWebSocket();
} }
function testWebSocket() { function testWebSocket() {
websocket = new WebSocket("ws://127.0.0.1:7681", "observer"); websocket = new WebSocket(wsURI, "observer");
websocket.onopen = function (evt) { onOpen(evt) }; websocket.onopen = function (evt) { onOpen(evt) };
websocket.onclose = function (evt) { onClose(evt) }; websocket.onclose = function (evt) { onClose(evt) };
websocket.onmessage = function (evt) { onMessage(evt) }; websocket.onmessage = function (evt) { onMessage(evt) };
@ -77,7 +78,6 @@
window.addEventListener("load", init, false); window.addEventListener("load", init, false);
</script> </script>
<p>Response of server: <span id="people"></span>
<p>Status: <span id="status">unknown</span> <p>Status: <span id="status">unknown</span>
<div id="screen"> <div id="screen">