aboutsummaryrefslogtreecommitdiff
path: root/examples/node/client.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/node/client.mjs')
-rw-r--r--examples/node/client.mjs11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/node/client.mjs b/examples/node/client.mjs
new file mode 100644
index 0000000..2a10d1e
--- /dev/null
+++ b/examples/node/client.mjs
@@ -0,0 +1,11 @@
+import WebSocket from 'ws';
+
+const u = 'wss://localhost:4443';
+//const u = 'ws://localhost:3000';
+
+const ws = new WebSocket(u, {
+ rejectUnauthorized: false,
+});
+
+ws.on('open', () => ws.send('something'))
+ws.on('message', msg => console.log('received: %s', msg))