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

- old
+ new

@@ -20,9 +20,14 @@ 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.") + return Ably::Util::SafeDeferrable.new_and_fail_immediately(logger, error) + end + connection.send_protocol_message( action: Ably::Models::ProtocolMessage::ACTION.Message.to_i, channel: channel_name, messages: messages )