fix: WebSocket funktioniert

This commit is contained in:
ISA
2025-06-12 07:16:38 +02:00
parent 0a97c359d8
commit 71df8df72d
10 changed files with 10 additions and 1923 deletions

View File

@@ -12,7 +12,7 @@ NEXT_PUBLIC_DEBUG_LOG=false
#auf dem Entwicklungsrechner dev läuft auf Port 3000 und auf dem Server prod auf Port 80, aber der WebService ist immer auf PORT 80 #auf dem Entwicklungsrechner dev läuft auf Port 3000 und auf dem Server prod auf Port 80, aber der WebService ist immer auf PORT 80
NEXT_PUBLIC_API_PORT_MODE=prod
NEXT_PUBLIC_USE_MOCKS=false NEXT_PUBLIC_USE_MOCKS=false
# Der Unterordner talas5 gleich hinter der IP-Adresse (oder Servername) muss konfigurierbar sein. # Der Unterordner talas5 gleich hinter der IP-Adresse (oder Servername) muss konfigurierbar sein.

View File

@@ -806,14 +806,13 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
const m = params.get("m"); const m = params.get("m");
const u = params.get("u"); const u = params.get("u");
const mode = process.env.NEXT_PUBLIC_USE_MOCKS === "true" ? "mock" : "live";
const socket = io({ const socket = io(process.env.NEXT_PUBLIC_SOCKET_URL, {
query: { m, u, mode }, query: { m, u },
}); });
socket.on("connect", () => { socket.on("connect", () => {
console.log("🔗 WebSocket verbunden (Modus:", mode, ")"); console.log("🔗 WebSocket verbunden ");
}); });
socket.on("GisLinesStatusUpdated", data => { socket.on("GisLinesStatusUpdated", data => {

View File

@@ -1,2 +1,2 @@
// /config/appVersion // /config/appVersion
export const APP_VERSION = "1.1.254"; export const APP_VERSION = "1.1.255";

2
package-lock.json generated
View File

@@ -1,5 +1,5 @@
{ {
"name": "10.06.2025 NodeMap at home", "name": "11.06.2025 NodeMap",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {

View File

@@ -34,8 +34,8 @@ app.prepare().then(() => {
const io = new Server(server); const io = new Server(server);
io.on("connection", socket => { io.on("connection", socket => {
const { m: idMap, u: idUser, mode } = socket.handshake.query; const { m: idMap, u: idUser } = socket.handshake.query;
console.log(`🔌 WebSocket verbunden (idMap=${idMap}, idUser=${idUser}, mode=${mode})`); console.log(`🔌 WebSocket verbunden (idMap=${idMap}, idUser=${idUser})`);
const endpoints = [ const endpoints = [
{ {
@@ -79,7 +79,7 @@ app.prepare().then(() => {
const jsonStr = fs.readFileSync(mockPath, "utf-8"); const jsonStr = fs.readFileSync(mockPath, "utf-8");
const json = JSON.parse(jsonStr); const json = JSON.parse(jsonStr);
statis = extractData(json, name); statis = extractData(json, name);
//console.log(`🧪 [Mock] ${name}`); console.log(`🧪 [Mock] ${name}`);
} else { } else {
const fetchUrl = `http://localhost/talas5/ClientData/${getUrl()}`; const fetchUrl = `http://localhost/talas5/ClientData/${getUrl()}`;
const res = await fetch(fetchUrl); const res = await fetch(fetchUrl);
@@ -115,7 +115,7 @@ app.prepare().then(() => {
// fetchData immer ausführen unabhängig vom Modus // fetchData immer ausführen unabhängig vom Modus
fetchData(); fetchData();
const interval = setInterval(fetchData, 12000); // 12 Sekunden ,TALAS.web nutzt auch 12 Sekunden const interval = setInterval(fetchData, 5000); // 5 Sekunden ,TALAS.web nutzt 12 Sekunden
socket.on("disconnect", () => { socket.on("disconnect", () => {
clearInterval(interval); clearInterval(interval);
console.log("❌ WebSocket getrennt"); console.log("❌ WebSocket getrennt");

File diff suppressed because it is too large Load Diff

View File

@@ -1,112 +0,0 @@
[
{
"IdLD": 50937,
"IdL": 24101,
"IdDP": 3,
"Na": "FBT",
"Val": "15",
"Unit": "°C",
"Gr": "GMA",
"Area_Name": "Rastede"
},
{
"IdLD": 50937,
"IdL": 24101,
"IdDP": 10,
"Na": "GT",
"Val": "-2.14",
"Unit": "°C",
"Gr": "GMA",
"Area_Name": "Rastede"
},
{
"IdLD": 50937,
"IdL": 24101,
"IdDP": 2,
"Na": "LT",
"Val": "0.21",
"Unit": "°C",
"Gr": "GMA",
"Area_Name": "Rastede"
},
{
"IdLD": 50937,
"IdL": 24101,
"IdDP": 6,
"Na": "RLF",
"Val": "77.54",
"Unit": "%",
"Gr": "GMA",
"Area_Name": "Rastede"
},
{
"IdLD": 50937,
"IdL": 24101,
"IdDP": 4,
"Na": "RS",
"Val": "30.33",
"Unit": "%",
"Gr": "GMA",
"Area_Name": "Rastede"
},
{
"IdLD": 50937,
"IdL": 24101,
"IdDP": 11,
"Na": "TPT",
"Val": "2.99",
"Unit": "°C",
"Gr": "GMA",
"Area_Name": "Rastede"
},
{
"IdLD": 50937,
"IdL": 24101,
"IdDP": 12,
"Na": "TT1",
"Val": "0.1245",
"Unit": "°C",
"Gr": "GMA",
"Area_Name": "Rastede"
},
{
"IdLD": 50937,
"IdL": 24101,
"IdDP": 16,
"Na": "WFD",
"Val": "0.211",
"Unit": "mm",
"Gr": "GMA",
"Area_Name": "Rastede"
},
{
"IdLD": 50937,
"IdL": 24101,
"IdDP": 8,
"Na": "WGM",
"Val": "0.5",
"Unit": "m/s",
"Gr": "GMA",
"Area_Name": "Rastede"
},
{
"IdLD": 50937,
"IdL": 24101,
"IdDP": 9,
"Na": "WGS",
"Val": "0.75",
"Unit": "m/s",
"Gr": "GMA",
"Area_Name": "Rastede"
},
{
"IdLD": 50937,
"IdL": 24101,
"IdDP": 7,
"Na": "WR",
"Val": "180",
"Unit": "°",
"Gr": "GMA",
"Area_Name": "Rastede"
}
]

View File

@@ -1,155 +0,0 @@
[
{
"LD_Name": "CPL Ismail",
"IdLD": 50922,
"Device": "CPL V3.5 mit 24 Kü",
"Link": "cpl.aspx?ver=35&kue=24&id=50922",
"Location_Name": "Littwin",
"Location_Short": "LTW",
"IdLocation": 24101,
"Area_Name": "Rastede",
"Area_Short": "",
"IdArea": 20998,
"X": 53.242157,
"Y": 8.160353,
"Icon": 20,
"System": 1,
"Active": 1
},
{
"LD_Name": "LR 77 ISA",
"IdLD": 50935,
"Device": "LTE Modem LR77",
"Link": "lr77.aspx?ver=1&id=50935",
"Location_Name": "Littwin",
"Location_Short": "LTW",
"IdLocation": 24101,
"Area_Name": "Rastede",
"Area_Short": "",
"IdArea": 20998,
"X": 53.242157,
"Y": 8.160353,
"Icon": 12,
"System": 5,
"Active": 1
},
{
"LD_Name": "Cisco Router 1841",
"IdLD": 50936,
"Device": "Cisco 1841",
"Link": "cisco1841.aspx?ver=1&id=50936",
"Location_Name": "Littwin",
"Location_Short": "LTW",
"IdLocation": 24101,
"Area_Name": "Rastede",
"Area_Short": "",
"IdArea": 20998,
"X": 53.242157,
"Y": 8.160353,
"Icon": 21,
"System": 6,
"Active": 1
},
{
"LD_Name": "GMA Testgerät ISA",
"IdLD": 50937,
"Device": "Glättemeldeanlage",
"Link": "gma.aspx?ver=1&id=50937",
"Location_Name": "Littwin",
"Location_Short": "LTW",
"IdLocation": 24101,
"Area_Name": "Rastede",
"Area_Short": "",
"IdArea": 20998,
"X": 53.242157,
"Y": 8.160353,
"Icon": 1,
"System": 11,
"Active": 1
},
{
"LD_Name": "SMS-Funkmodem",
"IdLD": 50938,
"Device": "SMS Funkmodem",
"Link": "sms_modem.aspx?ver=1&id=50938",
"Location_Name": "Littwin",
"Location_Short": "LTW",
"IdLocation": 24101,
"Area_Name": "Rastede",
"Area_Short": "",
"IdArea": 20998,
"X": 53.242157,
"Y": 8.160353,
"Icon": 12,
"System": 111,
"Active": 1
},
{
"LD_Name": "TALAS Meldestationen ISA",
"IdLD": 50939,
"Device": "CPL V3.5 mit 16 Kü",
"Link": "cpl.aspx?ver=35&kue=16&id=50939",
"Location_Name": "Littwin",
"Location_Short": "LTW",
"IdLocation": 24101,
"Area_Name": "Rastede",
"Area_Short": "",
"IdArea": 20998,
"X": 53.242157,
"Y": 8.160353,
"Icon": 20,
"System": 1,
"Active": 1
},
{
"LD_Name": "WAGO Klemmen ISA",
"IdLD": 50941,
"Device": "WAGO 16 DE",
"Link": "wago.aspx?ver=1&DE=16&id=50941",
"Location_Name": "Littwin",
"Location_Short": "LTW",
"IdLocation": 24101,
"Area_Name": "Rastede",
"Area_Short": "",
"IdArea": 20998,
"X": 53.242157,
"Y": 8.160353,
"Icon": 9,
"System": 7,
"Active": 1
},
{
"LD_Name": "Cisco 1921",
"IdLD": 50942,
"Device": "Cisco 1921",
"Link": "cisco1921.aspx?ver=1&id=50942",
"Location_Name": "Littwin",
"Location_Short": "LTW",
"IdLocation": 24101,
"Area_Name": "Rastede",
"Area_Short": "",
"IdArea": 20998,
"X": 53.242157,
"Y": 8.160353,
"Icon": 21,
"System": 6,
"Active": 1
},
{
"LD_Name": "Cisco 8200",
"IdLD": 50943,
"Device": "Cisco 8200",
"Link": "cisco8200.aspx?ver=1&id=50943",
"Location_Name": "Littwin",
"Location_Short": "LTW",
"IdLocation": 24101,
"Area_Name": "Rastede",
"Area_Short": "",
"IdArea": 20998,
"X": 53.242157,
"Y": 8.160353,
"Icon": 21,
"System": 6,
"Active": 1
}
]

View File

@@ -1,101 +0,0 @@
[
{
"IdLD": 50922,
"Na": "system",
"Le": 4,
"Co": "#FF00FF",
"Me": "Eingang DE 01 kommend test2",
"Feld": 4,
"Icon": 0
},
{
"IdLD": 50922,
"Na": "system",
"Le": 4,
"Co": "#FF00FF",
"Me": "Eingang DE 05 kommend",
"Feld": 4,
"Icon": 0
},
{
"IdLD": 50922,
"Na": "system",
"Le": 4,
"Co": "#FF00FF",
"Me": "Eingang DE 17 kommend",
"Feld": 4,
"Icon": 0
},
{
"IdLD": 50922,
"Na": "system",
"Le": 4,
"Co": "#FF00FF",
"Me": "Eingang DE 31 kommend",
"Feld": 4,
"Icon": 0
},
{
"IdLD": 50922,
"Na": "system",
"Le": 4,
"Co": "#FF00FF",
"Me": "Eingang DE 32 kommend",
"Feld": 4,
"Icon": 0
},
{
"IdLD": 50922,
"Na": "system",
"Le": 4,
"Co": "#FF00FF",
"Me": "Station offline",
"Feld": 4,
"Icon": 0
},
{
"IdLD": 50922,
"Na": "minor",
"Le": 3,
"Co": "#FFFF00",
"Me": "Eingang DE 02 kommend",
"Feld": 4,
"Icon": 0
},
{
"IdLD": 50922,
"Na": "minor",
"Le": 3,
"Co": "#FFFF00",
"Me": "KÜG 08: Überspannung gehend",
"Feld": 4,
"Icon": 0
},
{
"IdLD": 50922,
"Na": "major",
"Le": 2,
"Co": "#FF9900",
"Me": "Eingang DE 03 kommend",
"Feld": 4,
"Icon": 0
},
{
"IdLD": 50922,
"Na": "critical",
"Le": 1,
"Co": "#FF0000",
"Me": "KÜG 02: Aderbruch kommend",
"Feld": 4,
"Icon": 0
},
{
"IdLD": 50922,
"Na": "critical",
"Le": 1,
"Co": "#FF0000",
"Me": "KÜG 03: Aderbruch kommend",
"Feld": 4,
"Icon": 0
}
]

View File

@@ -1,114 +0,0 @@
[
{
"IdSystem": 1,
"Name": "TALAS",
"Longname": "Talas Meldestationen",
"Allow": 1,
"Icon": 1
},
{
"IdSystem": 2,
"Name": "ECI",
"Longname": "ECI Geräte",
"Allow": 1,
"Icon": 2
},
{
"IdSystem": 3,
"Name": "ULAF",
"Longname": "ULAF Geräte",
"Allow": 0,
"Icon": 3
},
{
"IdSystem": 5,
"Name": "GSM Modem",
"Longname": "LR77 GSM Modems",
"Allow": 1,
"Icon": 5
},
{
"IdSystem": 6,
"Name": "Cisco Router",
"Longname": "Cisco Router",
"Allow": 1,
"Icon": 6
},
{
"IdSystem": 7,
"Name": "WAGO",
"Longname": "WAGO I/O Systeme",
"Allow": 1,
"Icon": 7
},
{
"IdSystem": 8,
"Name": "Siemens",
"Longname": "Siemens Notrufsysteme",
"Allow": 1,
"Icon": 8
},
{
"IdSystem": 9,
"Name": "OTDR",
"Longname": "Glasfaserüberwachung OTU",
"Allow": 1,
"Icon": 9
},
{
"IdSystem": 10,
"Name": "WDM",
"Longname": " Wavelength Division Multiplexing",
"Allow": 1,
"Icon": 10
},
{
"IdSystem": 11,
"Name": "GMA",
"Longname": "Glättemeldeanlagen",
"Allow": 1,
"Icon": 11
},
{
"IdSystem": 13,
"Name": "Messstellen",
"Longname": "Messstellen",
"Allow": 1,
"Icon": 13
},
{
"IdSystem": 30,
"Name": "TK-Komponenten",
"Longname": "TK-Komponenten",
"Allow": 1,
"Icon": 30
},
{
"IdSystem": 100,
"Name": "TALAS ICL",
"Longname": "Talas ICL Unterstationen",
"Allow": 1,
"Icon": 100
},
{
"IdSystem": 110,
"Name": "DAUZ",
"Longname": "Dauerzählstellen",
"Allow": 1,
"Icon": 110
},
{
"IdSystem": 111,
"Name": "SMS Modem",
"Longname": "SMS Modem",
"Allow": 1,
"Icon": 111
},
{
"IdSystem": 200,
"Name": "Sonstige",
"Longname": "Sonstige",
"Allow": 1,
"Icon": 200
}
]