Method: NATS#unbind

Defined in:
lib/nats/client.rb

#unbindObject

:nodoc:

[View source]

1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
# File 'lib/nats/client.rb', line 1139

def unbind #:nodoc:
  # Allow notifying from which server we were disconnected,
  # but only when we didn't trigger disconnecting ourselves.
  if @disconnect_cb and connected? and not closing?
    @disconnect_cb.call(NATS::ConnectError.new(disconnect_error_string))
  end

  # If we are closing or shouldn't reconnect, go ahead and disconnect.
  process_disconnect and return if (closing? or should_not_reconnect?)
  @reconnecting = true if connected?
  @connected = false
  @pending = @pongs = nil
  @buf = nil
  cancel_ping_timer

  schedule_primary_and_connect
end