MQTT.js
MQTT.js copied to clipboard
Importing CA file
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