Method: NATS.stop

Defined in:
lib/nats/client.rb

.stop(&blk) ⇒ Object

Close the default client connection and optionally call the associated block.

Parameters:

  • &blk (Block)

    called when the connection is closed.



256
257
258
259
260
261
262
263
# File 'lib/nats/client.rb', line 256

def stop(&blk)
  client.close if (client and (client.connected? || client.reconnecting?))
  blk.call if blk
  @err_cb = nil
  @close_cb = nil
  @reconnect_cb = nil
  @disconnect_cb = nil
end