Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-signed certs #19

Closed
narsariusv opened this issue May 5, 2019 · 3 comments
Closed

Self-signed certs #19

narsariusv opened this issue May 5, 2019 · 3 comments

Comments

@narsariusv
Copy link

narsariusv commented May 5, 2019

Getting connection errors due to self-signed certs. Is their an option similar to ws that allows you to bypass the connection error?

const WebSocket = require('ws');
const ws = new WebSocket('wss://url',{rejectUnauthorized: false});
@narsariusv
Copy link
Author

narsariusv commented May 5, 2019

Resolved - Had to use ws instead of websockets. Then as ws wouldn't work I had to implement the fix from #15 (comment)

Doesnt look like my msgs are making it to the server though, could this be another issue with using ws? When I follow the change you recommended in the previous thread, appending .ws to wsp it forces the connection closed without me calling a wsp.close(), when this occurs the connections closed event is 1006.

wsp.onClose.addListener(event => console.log(`Connections closed: ${event}`));
wsp.open()
  .then(() => wsp.onMessage.addListener(message => console.log('test: ' + message)))
  .then(() => wsp.ws.send('hello from client'))
  //.then(() => wsp.close())
  .catch(e => console.error(e));

@vitalets
Copy link
Owner

@narsariusv
Does the connection closed only when used with websocket-as-promised?

@vitalets
Copy link
Owner

Working with ws package is now officially supported (since 0.10.0).
Please have a look on this section in readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants