From 52e7f26fd7fe628ce1c5a8dc38b5f803b16e348d Mon Sep 17 00:00:00 2001 From: Mark de Bruijn Date: Mon, 19 Feb 2024 22:07:02 +0100 Subject: [PATCH] Let the proxy use the configured audio port --- index.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 42efd69..a6a2759 100644 --- a/index.js +++ b/index.js @@ -19,13 +19,6 @@ const path = require('path'); const net = require('net'); const client = new net.Socket(); -// Create a WebSocket proxy instance -const proxy = httpProxy.createProxyServer({ - target: 'ws://localhost:8081', // WebSocket httpServer's address - ws: true, // Enable WebSocket proxying - changeOrigin: true // Change the origin of the host header to the target URL -}); - // Other files and libraries const crypto = require('crypto'); const fs = require('fs'); @@ -36,9 +29,15 @@ const consoleCmd = require('./console'); const audioStream = require('./stream/index.js'); const { parseAudioDevice } = require('./stream/parser.js'); const { configName, serverConfig, configUpdate, configSave } = require('./server_config'); - const { logDebug, logError, logInfo, logWarn } = consoleCmd; +// Create a WebSocket proxy instance +const proxy = httpProxy.createProxyServer({ + target: 'ws://localhost:'+ serverConfig.webserver.audioPort, // WebSocket httpServer's address + ws: true, // Enable WebSocket proxying + changeOrigin: true // Change the origin of the host header to the target URL +}); + let currentUsers = 0; let streamEnabled = false; let incompleteDataBuffer = '';