lib/ably/realtime/channel/publisher.rb in ably-1.1.7 vs lib/ably/realtime/channel/publisher.rb in ably-1.1.8

- old
+ new

@@ -20,11 +20,12 @@ raise Ably::Exceptions::IncompatibleClientId.new("Cannot publish with client_id '#{message.client_id}' as it is incompatible with the current configured client_id '#{client.client_id}'") end end end - if messages.sum(&:size) > Ably::Realtime::Connection::MAX_MESSAGE_SIZE - error = Ably::Exceptions::MaxMessageSizeExceeded.new("Message size exceeded #{Ably::Realtime::Connection::MAX_MESSAGE_SIZE} bytes.") + max_message_size = connection.details && connection.details.max_message_size || Ably::Models::ConnectionDetails::MAX_MESSAGE_SIZE + if messages.sum(&:size) > max_message_size + error = Ably::Exceptions::MaxMessageSizeExceeded.new("Message size exceeded #{max_message_size} bytes.") return Ably::Util::SafeDeferrable.new_and_fail_immediately(logger, error) end connection.send_protocol_message( action: Ably::Models::ProtocolMessage::ACTION.Message.to_i,