MQTT.js icon indicating copy to clipboard operation
MQTT.js copied to clipboard

Importing CA file

Open YassineChe opened this issue 2 years ago • 0 comments

Hello,

How i can use CA file ?

This is i snapshot from my JS file

import mqtt from "mqtt";
import cert from 'raw-loader!./../certs/ca.crt'
..
var client = mqtt.connect('wss://hostname.xyz:8081', {
  ca: cert,
});

Also i tried to use import fs from 'fs'; but i get fs.readFileSync() is not a function"

In case my importation is correct (cause when i log crt file i can see the data of the file).

Here my Chrome console : WebSocket connection to 'wss://hostname:xyz/' failed:

Everything works fine when i try to connect it with MQTTX app

Im using the latest version of mosquitto, installed on my VPS.

Thanks

YassineChe avatar Jul 12 '22 21:07 YassineChe