This commit is contained in:
Christopher Cookman 2025-06-21 20:37:45 -06:00
parent e991b42e60
commit 41ec69ab94
2 changed files with 39 additions and 6 deletions

33
debug.js Normal file
View file

@ -0,0 +1,33 @@
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
if (msg.channel && msg.product_data) {
console.log(`Channel: ${msg.channel}, 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

@ -516,8 +516,8 @@ xmpp.on("stanza", (stanza) => {
connection.ws.send(JSON.stringify({ connection.ws.send(JSON.stringify({
"type": "iem-message", "type": "iem-message",
"data": { "data": {
"channel": fromChannel, "channel": getWFOByRoom(fromChannel),
"wfo": getWFOByRoom(fromChannel), "fromChannel": fromChannel,
"event": evt, "event": evt,
"body": bodyData, "body": bodyData,
"timestamp": product_id.timestamp, "timestamp": product_id.timestamp,
@ -545,8 +545,8 @@ xmpp.on("stanza", (stanza) => {
connection.ws.send(JSON.stringify({ connection.ws.send(JSON.stringify({
"type": "iem-message", "type": "iem-message",
"data": { "data": {
"channel": fromChannel, "channel": getWFOByRoom(fromChannel),
"wfo": getWFOByRoom(fromChannel), "fromChannel": fromChannel,
"event": evt, "event": evt,
"body": bodyData.string, "body": bodyData.string,
"timestamp": product_id.timestamp, "timestamp": product_id.timestamp,
@ -573,8 +573,8 @@ xmpp.on("stanza", (stanza) => {
evt, stanza, product_id, product_id_raw, bodyData, body, sentData: { evt, stanza, product_id, product_id_raw, bodyData, body, sentData: {
"type": "iem-message", "type": "iem-message",
"data": { "data": {
"channel": fromChannel, "channel": getWFOByRoom(fromChannel),
"wfo": getWFOByRoom(fromChannel), "fromChannel": fromChannel,
"event": evt, "event": evt,
"body": bodyData, "body": bodyData,
"timestamp": product_id.timestamp, "timestamp": product_id.timestamp,