diff --git a/lightclient/src/platform/wasm_socket.rs b/lightclient/src/platform/wasm_socket.rs index b189ded963..abe67e7c2d 100644 --- a/lightclient/src/platform/wasm_socket.rs +++ b/lightclient/src/platform/wasm_socket.rs @@ -242,9 +242,7 @@ impl AsyncWrite for WasmSocket { impl Drop for WasmSocket { fn drop(&mut self) { - if self.socket.ready_state() == web_sys::WebSocket::OPEN - || self.socket.ready_state() == web_sys::WebSocket::CONNECTING - { + if self.socket.ready_state() != web_sys::WebSocket::CLOSING { let _ = self.socket.close(); }