bug: suspendable put-bytevector.
[8sync.git] / demos / websocket / ws-client.html
diff --git a/demos/websocket/ws-client.html b/demos/websocket/ws-client.html
new file mode 100644 (file)
index 0000000..5e9c811
--- /dev/null
@@ -0,0 +1,43 @@
+<!--
+    8sync --- Asynchronous programming for Guile
+    Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+
+    This file is part of 8sync.
+
+    8sync is free software: you can redistribute it and/or modify it
+    under the terms of the GNU Lesser General Public License as
+    published by the Free Software Foundation, either version 3 of the
+    License, or (at your option) any later version.
+
+    8sync is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with 8sync.  If not, see <http://www.gnu.org/licenses/>.
+!-->
+<meta charset="utf8">
+<html>
+  <head>
+    <title>Ws test</title>
+  </head>
+  <body>
+    <p id="log"></p>
+    <script>
+      var server = "ws://localhost:1236";
+      var log = document.getElementById ("log");
+      console.log ('log=%j', log);
+      console.log ('document=%j', document);
+      console.log ('body=%j', document.body);
+      var ws = new WebSocket (server);
+      ws.onopen = function () {
+        console.log ('open!'); log.innerHTML += 'open!<br>';
+        ws.send ('Hello, Web Socket!');
+        ws.send ('Say: ' + 'A'.repeat (Math.pow (2, 16)) + '\n');
+      };
+      ws.close = function () { console.log ('close!'); log.innerHTML += 'close!<br>'; };
+      ws.onmessage = function () { console.log ('message'); log.innerHTML += 'message!<br>'; };
+    </script>
+  </body>
+</html>