summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-11-08 17:42:24 -0500
committerDavid Thompson <dthompson2@worcester.edu>2015-11-08 17:42:24 -0500
commitb6b13dfce0218278597a1429969a7d9d2cd75089 (patch)
tree071cca20f3de3fcc8a8da0708ede1d905c0d7b82
parentc18894ddb3b1dbfb94deea28114bce4967af2119 (diff)
Add test HTML page.
-rw-r--r--README16
-rw-r--r--test.html20
2 files changed, 22 insertions, 14 deletions
diff --git a/README b/README
index 5849d50..181a537 100644
--- a/README
+++ b/README
@@ -11,17 +11,5 @@ Run the example server:
GUILE_LOAD_PATH="$PWD:$GUILE_LOAD_PATH" guile test.scm
#+END_SRC
-Then, open a web browser and run the following in the JavaScript
-console:
-
-#+BEGIN_SRC javascript
- var ws = new WebSocket("ws://localhost:9090");
-
- ws.onmessage = function(message) {
- console.log(message.data);
- };
-
- ws.send("hello, there!")
-#+END_SRC
-
-If everything works, "!ereht ,olleh" will be written to the JavaScript console.
+Then, open the =text.html= page in your web browser. If everything
+works, "!ereht ,olleH" will be written to the JavaScript console.
diff --git a/test.html b/test.html
new file mode 100644
index 0000000..c8dc987
--- /dev/null
+++ b/test.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <script type="text/javascript">
+ var ws = new WebSocket("ws://localhost:9090");
+ console.log("initialized websocket");
+ ws.onmessage = function(evt) {
+ console.log("received message:");
+ console.log(evt);
+ };
+ ws.onopen = function() {
+ console.log("connected");
+ ws.send("Hello, there!");
+ }
+ ws.onclose = function() {
+ console.log("closed websocket");
+ }
+ </script>
+ </body>
+</html>