I have quite strange problem.
I'm developing electron application.
Lets focus only on main.js - it has all the basic components and then I have setupMQTT() function which handles all the MQTT stuff. So my main.js looks something like this. For the sake of simplicity I will omit a few things.
const { app, BrowserWindow } = require("electron");
const path = require("path");
const url = require("url");
import { connect, MqttClient } from "mqtt" // << this is for MQTT
// .. omitting
let MQTT: MqttClient;
function createWindow() {
let win = new BrowserWindow(/* ..omitting.. */);
win.loadURL(/* ..omitting.. */);
win.webContents.openDevTools({ mode: 'detach' });
win.on("closed", () => {
win = null;
});
}
// .. omitting
app.on("ready", () => {
createWindow();
setupMQTT(); // << if I comment this out `....openDevTools` works
});
function setupMQTT() {
MQTT = connect('...', {
hostname: '...',
port: 8883,
protocol: 'mqtts'
});
MQTT.on('connect', () => {});
MQTT.on('message', (topic, value) => {});
MQTT.on('error', (error) => {});
}
So if I comment out setupMQTT() dev tools will show, otherwise dev tools will not (also invoking them from menu doesn't work)
note - MQTT works (I get messages and all)
Any ideas? Thanks!