Skip to content

Commit

Permalink
refactored code for rest clientOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed May 22, 2024
1 parent fceb558 commit fffad06
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/ably/realtime/channel/channel_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def send_attach_protocol_message
message_options[:flags] = message_options[:flags].to_i | Ably::Models::ProtocolMessage::ATTACH_FLAGS_MAPPING[:resume]
end

message_options[:channelSerial] = channel.properties.channel_serial
message_options[:channelSerial] = channel.properties.channel_serial # RTL4c1
send_state_change_protocol_message Ably::Models::ProtocolMessage::ACTION.Attach, :suspended, message_options
end

Expand Down
2 changes: 1 addition & 1 deletion lib/ably/realtime/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def initialize(options)
unless @recover.empty?
recovery_context = RecoveryKeyContext.from_json(@recover, logger)
unless recovery_context.nil?
@channels.set_channel_serials recovery_context.channel_serials
@channels.set_channel_serials recovery_context.channel_serials # RTN16j
@connection.message_serial = recovery_context.msg_serial # RTN16f
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ably/realtime/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def create_websocket_transport
url_params = auth_params.merge(
'format' => client.protocol,
'echo' => client.echo_messages,
'v' => Ably::PROTOCOL_VERSION,
'v' => Ably::PROTOCOL_VERSION, # RSC7a
'agent' => client.rest_client.agent
)

Expand Down
7 changes: 2 additions & 5 deletions lib/ably/rest/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def initialize(options)

@agent = options.delete(:agent) || Ably::AGENT
@realtime_client = options.delete(:realtime_client)
@tls = options.delete(:tls) == false ? false : true
@tls = options.fetch(:tls, true); options.delete(:tls)
@environment = options.delete(:environment) # nil is production
@environment = nil if [:production, 'production'].include?(@environment)
@protocol = options.delete(:protocol) || :msgpack
Expand All @@ -200,10 +200,7 @@ def initialize(options)
@log_retries_as_info = options.delete(:log_retries_as_info)
@max_message_size = options.delete(:max_message_size) || MAX_MESSAGE_SIZE
@max_frame_size = options.delete(:max_frame_size) || MAX_FRAME_SIZE

if (@idempotent_rest_publishing = options.delete(:idempotent_rest_publishing)).nil?
@idempotent_rest_publishing = Ably::PROTOCOL_VERSION.to_f > 1.1
end
@idempotent_rest_publishing = options.fetch(:idempotent_rest_publishing, true); options.delete(:idempotent_rest_publishing)

if options[:fallback_hosts_use_default] && options[:fallback_hosts]
raise ArgumentError, "fallback_hosts_use_default cannot be set to try when fallback_hosts is also provided"
Expand Down

0 comments on commit fffad06

Please sign in to comment.