From ddbff495b382a6bf3292208c4cf5a87e26325b74 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Mon, 23 Jun 2025 17:41:31 -0600 Subject: [PATCH] asdf --- debug.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 debug.js diff --git a/debug.js b/debug.js new file mode 100644 index 0000000..cca50b0 --- /dev/null +++ b/debug.js @@ -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.'); +}); \ No newline at end of file