bug: suspendable put-bytevector.
[8sync.git] / demos / websocket / ws-client.html
1 <!--
2     8sync --- Asynchronous programming for Guile
3     Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
4
5     This file is part of 8sync.
6
7     8sync is free software: you can redistribute it and/or modify it
8     under the terms of the GNU Lesser General Public License as
9     published by the Free Software Foundation, either version 3 of the
10     License, or (at your option) any later version.
11
12     8sync is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU Lesser General Public License for more details.
16
17     You should have received a copy of the GNU Lesser General Public
18     License along with 8sync.  If not, see <http://www.gnu.org/licenses/>.
19 !-->
20 <meta charset="utf8">
21 <html>
22   <head>
23     <title>Ws test</title>
24   </head>
25   <body>
26     <p id="log"></p>
27     <script>
28       var server = "ws://localhost:1236";
29       var log = document.getElementById ("log");
30       console.log ('log=%j', log);
31       console.log ('document=%j', document);
32       console.log ('body=%j', document.body);
33       var ws = new WebSocket (server);
34       ws.onopen = function () {
35         console.log ('open!'); log.innerHTML += 'open!<br>';
36         ws.send ('Hello, Web Socket!');
37         ws.send ('Say: ' + 'A'.repeat (Math.pow (2, 16)) + '\n');
38       };
39       ws.close = function () { console.log ('close!'); log.innerHTML += 'close!<br>'; };
40       ws.onmessage = function () { console.log ('message'); log.innerHTML += 'message!<br>'; };
41     </script>
42   </body>
43 </html>