Updated conection process to work hopfully with docker.

This commit is contained in:
Karmaa
2025-03-05 16:15:51 -06:00
parent 713d43fc52
commit e800064f05
6 changed files with 52 additions and 45 deletions

View File

@@ -70,14 +70,12 @@ export function NewTerminal({ hostConfig }) {
// Write initial connection message
terminal.write("\r\n*** Connecting to backend ***\r\n");
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
let ioUrl = `${protocol}//${window.location.hostname}:${window.location.port}/socket.io/`;
if (window.location.hostname === "localhost") {
ioUrl = "http://localhost:8081";
}
const socket = io(ioUrl);
const socket = io(window.location.hostname === "localhost"
? 'http://localhost:8081'
: '/', {
path: '/socket.io',
transports: ['websocket', 'polling']
});
socketRef.current = socket;
socket.off("connect");