1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-26 22:13:53 +01:00

Let the proxy use the configured audio port

This commit is contained in:
Mark de Bruijn
2024-02-19 22:07:02 +01:00
parent 8b5e1e83d9
commit 52e7f26fd7

View File

@@ -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 = '';