This commit is contained in:
Sameh Abouel-saad
2025-06-06 05:31:03 +03:00
parent 203cde1cba
commit 6f42e5ab8d
10 changed files with 1582 additions and 400 deletions

View File

@@ -525,7 +525,13 @@ impl WasmClient {
impl Drop for WasmClient {
fn drop(&mut self) {
// Cleanup will be handled by the WebSocket close
// Close WebSocket connection if it exists
if let Some(ws) = self.websocket.take() {
ws.close().unwrap_or_else(|e| {
web_sys::console::warn_1(&format!("Failed to close WebSocket: {:?}", e).into());
});
web_sys::console::log_1(&"🔌 WebSocket connection closed on drop".into());
}
}
}