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 = { }
@ssl = false
@tls = nil
@tls = options[:tls] if options[:tls]
@ssl = options[:ssl] if options[:ssl] or @tls
@resp_sub = nil
@resp_map = nil
@resp_sub_prefix = nil
@nuid = NATS::NUID.new
@draining = false
@drained_subs = false
send_connect_command
end