From eabb52a6c0028bc4e4bf9cb1cf1add28ab3df185 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 10 May 2022 11:29:17 +0200 Subject: Doc + example + fix domain/host bug --- examples/node/client.mjs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 examples/node/client.mjs (limited to 'examples/node/client.mjs') 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)) -- cgit v1.2.3