lib/submodules/ably-ruby/lib/ably/rest/channel.rb in ably-rest-1.1.7 vs lib/submodules/ably-ruby/lib/ably/rest/channel.rb in ably-rest-1.1.8
- old
+ new
@@ -21,11 +21,10 @@
# @return [Ably::Rest::Channel::PushChannel]
# @api private
attr_reader :push
IDEMPOTENT_LIBRARY_GENERATED_ID_LENGTH = 9 # See spec RSL1k1
- MAX_MESSAGE_SIZE = 65536 # See spec TO3l8
# Initialize a new Channel object
#
# @param client [Ably::Rest::Client]
# @param name [String] The name of the channel
@@ -86,12 +85,12 @@
[[{ name: first, data: second }.merge(third)], nil]
end
messages.map! { |message| Ably::Models::Message(message.dup) }
- if messages.sum(&:size) > Ably::Rest::Channel::MAX_MESSAGE_SIZE
- raise Ably::Exceptions::MaxMessageSizeExceeded.new("Maximum message size exceeded #{Ably::Rest::Channel::MAX_MESSAGE_SIZE}.")
+ if messages.sum(&:size) > (max_message_size = client.max_message_size || Ably::Rest::Client::MAX_MESSAGE_SIZE)
+ raise Ably::Exceptions::MaxMessageSizeExceeded.new("Maximum message size exceeded #{max_message_size} bytes.")
end
payload = messages.map do |message|
Ably::Models::Message(message.dup).tap do |msg|
msg.encode client.encoders, options
@@ -166,9 +165,11 @@
# @api private
def update_options(channel_options)
@options = channel_options.clone.freeze
end
+ alias set_options update_options # (RSL7)
+ alias options= update_options
private
def base_path
"/channels/#{URI.encode_www_form_component(name)}"
end