aboutsummaryrefslogtreecommitdiff
path: root/examples/node/client.mjs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-05-10 11:29:17 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-05-10 11:29:17 +0200
commiteabb52a6c0028bc4e4bf9cb1cf1add28ab3df185 (patch)
tree14cdbd56685be7a82a2a2ebc51cfbfec8c9807db /examples/node/client.mjs
parentdf4a36990c799901463d63c78de0f0672b675688 (diff)
downloadtricot-eabb52a6c0028bc4e4bf9cb1cf1add28ab3df185.tar.gz
tricot-eabb52a6c0028bc4e4bf9cb1cf1add28ab3df185.zip
Doc + example + fix domain/host bug
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))