 
     if @sock?
       try
-        @initiatedClose = true
+        @autoReconnect = false
         @sock.close()
       catch error
         logger.error "Error while closing WebSocket: #{error}\n#{error.stack}"
       finally
         @sock = null
-
-    @removeAllListeners()
 
   # Alias to the close() method
   disconnect: -> @close()

    @pingerRef = null
    @messageCount = 0
    @lastMessageId = null
    @initiatedClose = false
    @autoReconnect = @cfg.websocket_auto_reconnect ? true

  # Shutdown the WebSocket for good (prevents auto-reconnect)


        # The WebSocket was closed
        @sock.once 'close', =>
          if @autoReconnect == true
            @sock = null

            if @pingerRef?
