summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hintz <t@thintz.com>2014-10-18 09:58:16 -0700
committerThomas Hintz <t@thintz.com>2014-10-18 09:58:16 -0700
commit91396e71e0eeef5483fc31e9086c1aadab7ebefa (patch)
tree62d7965d98ba993b0bdbc9c139ef595c6a1e642e
parent29561c4b7186dc0b36655aa572af375a6fa4a310 (diff)
downloadwebsockets-91396e71e0eeef5483fc31e9086c1aadab7ebefa.tar.gz
Adding hello example/test.
-rw-r--r--test/hello.scm12
-rw-r--r--test/index.html13
2 files changed, 25 insertions, 0 deletions
diff --git a/test/hello.scm b/test/hello.scm
new file mode 100644
index 0000000..8d73868
--- /dev/null
+++ b/test/hello.scm
@@ -0,0 +1,12 @@
+(import chicken scheme)
+(use spiffy websockets)
+
+(handle-not-found
+ (lambda (path)
+ (when (string= path "/web-socket")
+ (with-websocket
+ (lambda ()
+ (send-message (string-append "you said: " (receive-message))))))))
+
+(root-path ".")
+(start-server port: 8080)
diff --git a/test/index.html b/test/index.html
new file mode 100644
index 0000000..914f8b0
--- /dev/null
+++ b/test/index.html
@@ -0,0 +1,13 @@
+<html>
+ <body>
+ <script type="text/javascript">
+ var ws = new WebSocket("ws://localhost:8080/web-socket");
+ ws.onmessage = function(evt) {
+ alert(evt.data);
+ };
+ ws.onopen = function() {
+ ws.send('Hello!');
+ }
+ </script>
+ </body>
+</html>