当前位置: 动力学知识库 > 问答 > 编程问答 >

linux - Error in connecting to secured websocket

问题描述:

I am trying to connect with secured websocket using nodejs using ws library.Server is also using same ws library.

My ios and chrome webapp is able to connect to secured websocket

But as soon as I am trying to connect through a Linux based system the error thrown:

events.js:74

throw er; // Unhandled 'error' event

^

Error: CERT_UNTRUSTED

at SecurePair.<anonymous> (tls.js:1289:32)

at SecurePair.EventEmitter.emit (events.js:94:17)

at SecurePair.maybeInitFinished (tls.js:896:10)

at CleartextStream.read [as _read] (tls.js:430:15)

at CleartextStream.Readable.read (_stream_readable.js:304:10)

at EncryptedStream.write [as _write] (tls.js:344:25)

at doWrite (_stream_writable.js:250:12)

at writeOrBuffer (_stream_writable.js:237:5)

at EncryptedStream.Writable.write (_stream_writable.js:184:11)

at write (_stream_readable.js:557:24)

My code snippet is:

/*Websocket client ; gateway will intiate the connection to cloud*/

var WebSocket = require('ws');

var connection_client = new WebSocket('wss://IP:1337/macadd=' + process.argv[2] +'&platform=gateway'

);

Any help will be really appreciated.

网友答案:

CERT_UNTRUSTED may mean you are using a self-signed certificate that has not been trusted. Put the same certificate for HTTPS and WSS so the browser can prompt the user for trusting it.

分享给朋友:
您可能感兴趣的文章:
随机阅读: