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 server_port = 1236;
25 var wss = new require ('ws').Server ({port:server_port});
26 console.log ('listening: %s', server_port);
27 wss.on ('connection', function (ws) {
28 ws.onopen = function () {
29 console.log ('ws.onopen');
30 // process.nextTick (function () {
31 // ws.send ('Hello Web Socket');
35 ws.onerror = function (e) {
36 console.log ('ws.onerror: e=%s', '' + e);
38 ws.onclose = function () {
39 console.log ('ws.onclose');
41 ws.onmessage = function (event) {
43 console.log ('ws.onmessage: msg=%s', msg);