3 /// 8sync --- Asynchronous programming for Guile
4 /// Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
6 /// This file is part of 8sync.
8 /// 8sync is free software: you can redistribute it and/or modify it
9 /// under the terms of the GNU Lesser General Public License as
10 /// published by the Free Software Foundation, either version 3 of the
11 /// License, or (at your option) any later version.
13 /// 8sync is distributed in the hope that it will be useful,
14 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 /// GNU Lesser General Public License for more details.
18 /// You should have received a copy of the GNU Lesser General Public
19 /// License along with 8sync. If not, see <http://www.gnu.org/licenses/>.
21 var default_server = 'ws://localhost:1236';
25 var ws = new require ('ws') (default_server);
26 ws.onopen = function () {
27 console.log ('ws.onopen');
28 process.nextTick (function () {
29 ws.send ('Hello Web Socket');
32 ws.onerror = function (e) {
33 console.log ('ws.onerror: e=%s', '' + e);
35 ws.onclose = function () {
36 console.log ('ws.onclose');
38 ws.onmessage = function (event) {
40 console.log ('ws.onmessage: msg=%s', msg);