Method: NATS#connect_command
- Defined in:
- lib/nats/client.rb
permalink #connect_command ⇒ Object
:nodoc:
788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 |
# File 'lib/nats/client.rb', line 788 def connect_command #:nodoc: cs = { :verbose => @options[:verbose], :pedantic => @options[:pedantic], :lang => ::NATS::LANG, :version => ::NATS::VERSION, :protocol => ::NATS::PROTOCOL_VERSION, :echo => !@options[:no_echo] } case when @options[:user_credentials] nonce = @server_info[:nonce] cs[:jwt] = @user_jwt_cb.call cs[:sig] = @signature_cb.call(nonce) when @options[:nkeys_seed] nonce = @server_info[:nonce] cs[:nkey] = @user_nkey_cb.call cs[:sig] = @signature_cb.call(nonce) when @options[:token] cs[:auth_token] = @options[:token] when @uri.password.nil? cs[:auth_token] = @uri.user else cs[:user] = @uri.user cs[:pass] = @uri.password end if auth_connection? cs[:name] = @options[:name] if @options[:name] cs[:ssl_required] = @ssl if @ssl cs[:tls_required] = true if @tls "CONNECT #{cs.to_json}#{CR_LF}" end |