Compare commits

...

2 commits

Author SHA1 Message Date
Christopher Cookman ddbff495b3 asdf 2025-06-23 17:41:31 -06:00
Christopher Cookman b8fecd731c Working branch go brr 2025-06-23 17:36:33 -06:00
2 changed files with 32 additions and 1 deletions

31
debug.js Normal file
View file

@ -0,0 +1,31 @@
const WebSocket = require('ws');
const wsUrl = 'wss://iem-alerter.ko4wal.radio/iem'; // Replace with actual WebSocket URL
const ws = new WebSocket(wsUrl, {headers: {
'User-Agent': 'iem-debugger/1.0',
}});
ws.on('open', () => {
console.log('WebSocket connection opened.');
ws.send(JSON.stringify({"type":"subscribe"}));
});
ws.on('message', (data) => {
console.log("msg rx")
try {
const msg = JSON.parse(data);
// Assuming the message has 'channel' and 'product_id' fields
console.log(`Channel: ${msg.data.fromChannel}, Product ID: ${msg.product_data}`);
} catch (err) {
console.error('Error parsing message:', err);
}
});
ws.on('error', (err) => {
console.error('WebSocket error:', err);
});
ws.on('close', () => {
console.log('WebSocket connection closed.');
});

View file

@ -445,7 +445,7 @@ xmpp.on("stanza", (stanza) => {
// Stops spam from getting old messages
if (startup) return;
// Get channel name
fromChannel = stanza.attrs.from.split("@")[0];
const fromChannel = stanza.attrs.from.split("@")[0];
// Ignores
if (!stanza.getChild("x")) return; // No PID, ignore it
if (!stanza.getChild("x").attrs.product_id) return;