diff --git a/lib/src/ChainWebSocket.js b/lib/src/ChainWebSocket.js
index <HASH>..<HASH> 100644
--- a/lib/src/ChainWebSocket.js
+++ b/lib/src/ChainWebSocket.js
@@ -50,7 +50,12 @@ class ChainWebSocket {
                     this.recv_life --;
                     if( this.recv_life == 0){
                         console.error('keep alive timeout.');
-                        this.ws.terminate();
+                        if( this.ws.terminate ) {
+                            this.ws.terminate();
+                        }
+                        else{
+                            this.ws.close();
+                        }
                         clearInterval(this.keepalive_timer);
                         this.keepalive_timer = undefined;
                         return;
fix an issue in browser which doesn't have terminate method on WebSocket.