WSS prox konfiguration
This commit is contained in:
@@ -21,11 +21,15 @@ function setupCommandForwarding(wssInput, targetUrl) {
|
||||
|
||||
targetSocket.on("message", (msg) => {
|
||||
const data = msg.toString();
|
||||
console.log("⬅️ Message from Driver to Sim:", data);
|
||||
console.log("⬅️ Message from Driver to Sim:", data, "→ clients:", clients.size);
|
||||
// Broadcast to all connected browsers
|
||||
for (const client of clients) {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
client.send(data);
|
||||
try {
|
||||
client.send(data);
|
||||
} catch (err) {
|
||||
console.error("❌ Error sending to client:", err.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,9 +11,12 @@ function isJson(str) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var socketUrl = (location.protocol === 'https:' ? 'wss://' : 'ws://') + location.host + '/echo';
|
||||
var socket = new WebSocket(socketUrl);
|
||||
|
||||
//var socket = new WebSocket(String(document.location).replace("https://","wss://").replace("1003","2095").replace("index.html","") + "echo");
|
||||
//var socket = new WebSocket("wss://robot-ws.daniel-freund.de/echo");
|
||||
var socket = new WebSocket("wss://thinkcentre.local:2095/echo");
|
||||
//var socket = new WebSocket("wss://thinkcentre.local:2095/echo");
|
||||
socket.onopen = () => console.log('Connected') || setInterval(() => { lastPingRequest = Date.now();
|
||||
socket.send("Ping");
|
||||
}, 5000);
|
||||
|
||||
Reference in New Issue
Block a user