Ws: Error: self signed certificate trying to connect to vis WSS using vscode extension

Created on 15 Oct 2019  路  1Comment  路  Source: websockets/ws

I am trying to connect to the wss.

var WebSocket = require('ws');
var webSocket = new WebSocket('wss://localhost:8443/cart'); 

It connect without an error with the normal javascript. but when I am trying to connect to this with vscode extension it gives an error like

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: self signed certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
    at TLSSocket.emit (events.js:182:13)
    at TLSSocket._finishInit (_tls_wrap.js:631:8)
Emitted 'error' event at:
    at ClientRequest.req.on (/home/project/node_modules/ws/lib/websocket.js:554:15)
    at ClientRequest.emit (events.js:182:13)
    at TLSSocket.socketErrorListener (_http_client.js:391:9)
    at TLSSocket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
#### Steps to reproduce:

Most helpful comment

Use the rejectUnauthorized option:

const ws = new WebSocket('wss://localhost:8443/cart', { rejectUnauthorized: false });

>All comments

Use the rejectUnauthorized option:

const ws = new WebSocket('wss://localhost:8443/cart', { rejectUnauthorized: false });
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sherikapotein picture sherikapotein  路  3Comments

dcflow picture dcflow  路  4Comments

cmnstmntmn picture cmnstmntmn  路  4Comments

HanHtoonAung picture HanHtoonAung  路  3Comments

quesurifn picture quesurifn  路  3Comments