added debounce to connection open and close events