fix: Handle WebSocket connection close in terminal.blade.php
This commit is contained in:
		@@ -67,6 +67,12 @@
 | 
				
			|||||||
                    socket.onerror = (e) => {
 | 
					                    socket.onerror = (e) => {
 | 
				
			||||||
                        console.error('WebSocket error:', 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);
 | 
					                    term.resize(termWidth, termHeight);
 | 
				
			||||||
                    socket.send(JSON.stringify({
 | 
					                    socket.send(JSON.stringify({
 | 
				
			||||||
                        resize: {
 | 
					                        resize: {
 | 
				
			||||||
                            cols: termWidth,
 | 
					                            cols: 600,
 | 
				
			||||||
                            rows: termHeight
 | 
					                            rows: 600
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }));
 | 
					                    }));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user