Socket.io + SSL + self-signed CA certificate gives error when connecting

前端 未结 4 1630
后悔当初
后悔当初 2020-12-19 04:34

I am running an https server using a certificate which was created using a self-signed CA certificate.

Now I want to connect Socket.io client to the Socket.io server

4条回答
  •  Happy的楠姐
    2020-12-19 05:16

    four years later but for any finding this post like me if you need to force client socket to not reject a self-signed server cert you need rejectUnauthorized: false as in const socket = require('socket.io-client')('https://192.168.0.31', { transports: ['websocket'], rejectUnauthorized: false }) from https://github.com/socketio/engine.io-client#methods

    also there is now a good source for free certs so now you don't even have to be "cheap d*ck" https://letsencrypt.org/

提交回复
热议问题