From 7df5ef5124ff6906c241d234005a03a2e92a775b Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Thu, 16 May 2024 22:38:35 +0530 Subject: [PATCH] Added separate method for creating a recovery key --- lib/ably/realtime/connection.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ably/realtime/connection.rb b/lib/ably/realtime/connection.rb index 2188a735..8d1123eb 100644 --- a/lib/ably/realtime/connection.rb +++ b/lib/ably/realtime/connection.rb @@ -340,7 +340,14 @@ def internet_up? # @return [String] # def recovery_key - "#{key}:#{serial}:#{message_serial}" if connection_resumable? + create_recovery_key + end + + def create_recovery_key + if key.nil? || key.empty? || state == :closing || state == :closed || state == :failed || state == :suspended + return ""; + end + RecoveryKeyContext.to_json(key, message_serial, client.channels.get_channel_serials) end # Following a new connection being made, the connection ID, connection key