# File lib/nats/client.rb, line 453
  def initialize(options)
    @options = options
    process_uri_options

    @buf = nil
    @ssid, @subs = 1, {}
    @err_cb = NATS.err_cb
    @close_cb = NATS.close_cb
    @reconnect_cb = NATS.reconnect_cb
    @disconnect_cb = NATS.disconnect_cb
    @reconnect_timer, @needed = nil, nil
    @connected, @closing, @reconnecting, @conn_cb_called = false, false, false, false
    @msgs_received = @msgs_sent = @bytes_received = @bytes_sent = @pings = 0
    @pending_size = 0
    @server_info = { }

    # Mark whether we should be connecting securely, try best effort
    # in being compatible with present ssl support.
    @ssl = false
    @tls = nil
    @tls = options[:tls] if options[:tls]
    @ssl = options[:ssl] if options[:ssl] or @tls

    # New style request/response implementation.
    @resp_sub = nil
    @resp_map = nil
    @resp_sub_prefix = nil
    @nuid = NATS::NUID.new

    # Drain mode
    @draining = false
    @drained_subs = false
    send_connect_command
  end