diff --git a/lib/nats/client.rb b/lib/nats/client.rb index be527a68..1ddeccd6 100644 --- a/lib/nats/client.rb +++ b/lib/nats/client.rb @@ -10,7 +10,6 @@ module NATS - PROTOCOL_VERSION = 1 DEFAULT_PORT = 4222 DEFAULT_URI = "nats://localhost:#{DEFAULT_PORT}".freeze @@ -519,9 +518,9 @@ def connect_command #:nodoc: cs = { :verbose => @options[:verbose], :pedantic => @options[:pedantic], - :lang => :ruby, - :version => VERSION, - :protocol => PROTOCOL_VERSION + :lang => ::NATS::LANG, + :version => ::NATS::VERSION, + :protocol => ::NATS::PROTOCOL_VERSION } if auth_connection? cs[:user] = @uri.user diff --git a/lib/nats/version.rb b/lib/nats/version.rb index 3993dbc1..60787dcc 100644 --- a/lib/nats/version.rb +++ b/lib/nats/version.rb @@ -1,3 +1,6 @@ module NATS - VERSION = "0.8.0".freeze + # NOTE: These are all announced to the server on CONNECT + VERSION = "0.8.2".freeze + LANG = RUBY_ENGINE + PROTOCOL_VERSION = 1 end diff --git a/spec/client/client_spec.rb b/spec/client/client_spec.rb index e2772f79..b1180d7f 100644 --- a/spec/client/client_spec.rb +++ b/spec/client/client_spec.rb @@ -393,14 +393,14 @@ def c.send_ping it 'should allowing setting name for the client on connect' do with_em_timeout do - connect_command = "CONNECT {\"verbose\":false,\"pedantic\":false,\"lang\":\"ruby\",\"version\":\"#{NATS::VERSION}\",\"protocol\":1,\"name\":\"hello\"}\r\n" + connect_command = "CONNECT {\"verbose\":false,\"pedantic\":false,\"lang\":\"#{NATS::LANG}\",\"version\":\"#{NATS::VERSION}\",\"protocol\":#{NATS::PROTOCOL_VERSION},\"name\":\"hello\"}\r\n" conn = NATS.connect(:name => "hello") expect(conn.connect_command).to eql(connect_command) end end it 'should not repeat SUB commands when connecting' do - pending_commands = "CONNECT {\"verbose\":false,\"pedantic\":true,\"lang\":\"ruby\",\"version\":\"#{NATS::VERSION}\",\"protocol\":1}\r\n" + pending_commands = "CONNECT {\"verbose\":false,\"pedantic\":true,\"lang\":\"#{NATS::LANG}\",\"version\":\"#{NATS::VERSION}\",\"protocol\":#{NATS::PROTOCOL_VERSION}}\r\n" pending_commands += "PING\r\n" pending_commands += "SUB hello 2\r\nSUB hello 3\r\nSUB hello 4\r\nSUB hello 5\r\nSUB hello 6\r\n"