WHYYYYYY
This commit is contained in:
parent
e991b42e60
commit
41ec69ab94
33
debug.js
Normal file
33
debug.js
Normal 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.');
|
||||
});
|
12
index.js
12
index.js
|
@ -516,8 +516,8 @@ xmpp.on("stanza", (stanza) => {
|
|||
connection.ws.send(JSON.stringify({
|
||||
"type": "iem-message",
|
||||
"data": {
|
||||
"channel": fromChannel,
|
||||
"wfo": getWFOByRoom(fromChannel),
|
||||
"channel": getWFOByRoom(fromChannel),
|
||||
"fromChannel": fromChannel,
|
||||
"event": evt,
|
||||
"body": bodyData,
|
||||
"timestamp": product_id.timestamp,
|
||||
|
@ -545,8 +545,8 @@ xmpp.on("stanza", (stanza) => {
|
|||
connection.ws.send(JSON.stringify({
|
||||
"type": "iem-message",
|
||||
"data": {
|
||||
"channel": fromChannel,
|
||||
"wfo": getWFOByRoom(fromChannel),
|
||||
"channel": getWFOByRoom(fromChannel),
|
||||
"fromChannel": fromChannel,
|
||||
"event": evt,
|
||||
"body": bodyData.string,
|
||||
"timestamp": product_id.timestamp,
|
||||
|
@ -573,8 +573,8 @@ xmpp.on("stanza", (stanza) => {
|
|||
evt, stanza, product_id, product_id_raw, bodyData, body, sentData: {
|
||||
"type": "iem-message",
|
||||
"data": {
|
||||
"channel": fromChannel,
|
||||
"wfo": getWFOByRoom(fromChannel),
|
||||
"channel": getWFOByRoom(fromChannel),
|
||||
"fromChannel": fromChannel,
|
||||
"event": evt,
|
||||
"body": bodyData,
|
||||
"timestamp": product_id.timestamp,
|
||||
|
|
Loading…
Reference in a new issue