         @unsuccessfulAttempt++
         @emit "brokerNotResponding"
 
-        brokerURL = @broker.sockURL.replace("/subscribe")
+        brokerURL = @brokerURL()
         KD.utils.warnAndLog 'broker not responding', {@unsuccessfulAttempt, brokerURL}
 
       @broker.ping =>

    # checking for the previous unsuccessful attempts
    @unsuccessfulAttempt = 0
    @broker.disconnect no
    brokerURL = @broker.sockURL.replace("/subscribe", "")
    @broker.selectAndConnect [brokerURL]


  recover: (callback) ->

    @broker.on "ready", =>
      @emit "brokerConnected"

  brokerURL:->
    @broker.sockURL.replace("/subscribe", "")

  checkStatus: ->
    {timeout} = @getOptions()
