lib/ably/realtime/client/incoming_message_dispatcher.rb in ably-1.1.6 vs lib/ably/realtime/client/incoming_message_dispatcher.rb in ably-1.1.7
- old
+ new
@@ -119,18 +119,26 @@
when ACTION.Sync
presence = get_channel(protocol_message.channel).presence
presence.manager.sync_process_messages protocol_message.channel_serial, protocol_message.presence
when ACTION.Presence
- presence = get_channel(protocol_message.channel).presence
- protocol_message.presence.each do |presence_message|
- presence.__incoming_msgbus__.publish :presence, presence_message
+ if protocol_message.has_correct_message_size?
+ presence = get_channel(protocol_message.channel).presence
+ protocol_message.presence.each do |presence_message|
+ presence.__incoming_msgbus__.publish :presence, presence_message
+ end
+ else
+ logger.fatal Ably::Exceptions::ProtocolError.new("Not published. Channel message limit exceeded #{protocol_message.message_size} bytes", 400, Ably::Exceptions::Codes::UNABLE_TO_RECOVER_CHANNEL_MESSAGE_LIMIT_EXCEEDED).message
end
when ACTION.Message
- channel = get_channel(protocol_message.channel)
- protocol_message.messages.each do |message|
- channel.__incoming_msgbus__.publish :message, message
+ if protocol_message.has_correct_message_size?
+ channel = get_channel(protocol_message.channel)
+ protocol_message.messages.each do |message|
+ channel.__incoming_msgbus__.publish :message, message
+ end
+ else
+ logger.fatal Ably::Exceptions::ProtocolError.new("Not published. Channel message limit exceeded #{protocol_message.message_size} bytes", 400, Ably::Exceptions::Codes::UNABLE_TO_RECOVER_CHANNEL_MESSAGE_LIMIT_EXCEEDED).message
end
when ACTION.Auth
client.auth.authorize