Skip to content

Commit d92819a

Browse files
committed
fix: Handle WebSocket connection close in terminal.blade.php
1 parent ea877f3 commit d92819a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

resources/views/livewire/project/shared/terminal.blade.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ function initializeWebSocket() {
6767
socket.onerror = (e) => {
6868
console.error('WebSocket error:', e);
6969
};
70+
socket.onclose = () => {
71+
console.log('WebSocket connection closed');
72+
setInterval(() => {
73+
$wire.dispatch('error', 'Connection to terminal lost, please refresh the page.');
74+
}, 2000);
75+
};
7076
}
7177
}
7278
@@ -209,8 +215,8 @@ function checkIfProcessIsRunningAndKillIt() {
209215
term.resize(termWidth, termHeight);
210216
socket.send(JSON.stringify({
211217
resize: {
212-
cols: termWidth,
213-
rows: termHeight
218+
cols: 600,
219+
rows: 600
214220
}
215221
}));
216222
}

0 commit comments

Comments
 (0)