Skip to content Skip to sidebar Skip to footer

Websocket Ssl Connection

I am trying to test a secure websocket but I'm having trouble. Here is my test: var WebSocket = require('ws'); describe('testing Web Socket', function() { it('should do stuff',

Solution 1:

The https module is rejecting your self-signed cert (as one would hope). You can force it to stop checking by passing a rejectUnauthorized: false option (which WebSocket will pass down to https):

var ws = new WebSocket('wss://localhost:15449/', {
  protocolVersion: 8,
  origin: 'https://localhost:15449',
  rejectUnauthorized: false
});

Post a Comment for "Websocket Ssl Connection"