Quick question... Does anyone have a example of connecting to the eventsocket using JS in HTML?
This is what I have now. It works but making sure it's the right way long term.
const ip = getHubitatIP();
if (!ip) {
logAction('⚠️ Missing IP for TriggerLog WS', 'warn');
return;
}
window.flowTraceSocket = new WebSocket(`ws://${ip}/eventsocket`);
window.flowTraceSocket.addEventListener('open', () => {
logAction('🔍 [TriggerLog] WebSocket opened', 'info');
});
window.flowTraceSocket.addEventListener('message', ({ data }) => {
let evt;
try {
evt = JSON.parse(data);
} catch {
return;
}
...