--- /dev/null
+#! /usr/bin/env node
+
+/// 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/>.
+
+var default_server = 'ws://localhost:1236';
+
+// npm install -g ws
+function main () {
+ var ws = new require ('ws') (default_server);
+ ws.onopen = function () {
+ console.log ('ws.onopen');
+ process.nextTick (function () {
+ ws.send ('Hello Web Socket');
+ });
+ }
+ ws.onerror = function (e) {
+ console.log ('ws.onerror: e=%s', '' + e);
+ }
+ ws.onclose = function () {
+ console.log ('ws.onclose');
+ }
+ ws.onmessage = function (event) {
+ var msg = event.data;
+ console.log ('ws.onmessage: msg=%s', msg);
+ };
+}
+
+main ();