fix: Handle WebSocket connection close in terminal.blade.php

This commit is contained in:
Andras Bacsai
2024-09-17 11:30:46 +02:00
parent ea877f3623
commit d92819ab60

View File

@@ -67,6 +67,12 @@
socket.onerror = (e) => {
console.error('WebSocket error:', e);
};
socket.onclose = () => {
console.log('WebSocket connection closed');
setInterval(() => {
$wire.dispatch('error', 'Connection to terminal lost, please refresh the page.');
}, 2000);
};
}
}
@@ -209,8 +215,8 @@
term.resize(termWidth, termHeight);
socket.send(JSON.stringify({
resize: {
cols: termWidth,
rows: termHeight
cols: 600,
rows: 600
}
}));
}