Adding hello example/test.
parent
29561c4b71
commit
91396e71e0
@ -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)
|
@ -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>
|
Loading…
Reference in New Issue