diff --git a/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java b/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java index 5419b83f9..ea77799e3 100644 --- a/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java +++ b/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java @@ -272,6 +272,26 @@ public void transferToChannels(List queuedMessa private void clear() { map.clear(); } + + protected void setChannelSerialsFromRecoverOption(HashMap serials) { + for (Map.Entry entry : serials.entrySet()) { + String channelName = entry.getKey(); + String channelSerial = entry.getValue(); + Channel channel = this.get(channelName); + if (channel != null) { + channel.properties.channelSerial = channelSerial; + } + } + } + + protected HashMap getChannelSerials() { + HashMap channelSerials = new HashMap<>(); + for (Channel channel : this.values()) { + channelSerials.put(channel.name, channel.properties.channelSerial); + } + return channelSerials; + } + } /******************** diff --git a/lib/src/main/java/io/ably/lib/realtime/Connection.java b/lib/src/main/java/io/ably/lib/realtime/Connection.java index 473b5df4c..4e216ebf4 100644 --- a/lib/src/main/java/io/ably/lib/realtime/Connection.java +++ b/lib/src/main/java/io/ably/lib/realtime/Connection.java @@ -49,7 +49,9 @@ public class Connection extends EventEmitter * Spec: RTN16b, RTN16c + * @deprecated use createRecoveryKey method instead. */ + @Deprecated public String recoveryKey; /** diff --git a/lib/src/main/java/io/ably/lib/types/ChannelProperties.java b/lib/src/main/java/io/ably/lib/types/ChannelProperties.java index ea3094911..50a1ae989 100644 --- a/lib/src/main/java/io/ably/lib/types/ChannelProperties.java +++ b/lib/src/main/java/io/ably/lib/types/ChannelProperties.java @@ -13,5 +13,13 @@ public class ChannelProperties { */ public String attachSerial; + /** + * ChannelSerial contains the channelSerial from latest ProtocolMessage of action type + * Message/PresenceMessage received on the channel. + *

+ * Spec: CP2b, RTL15b + */ + public String channelSerial; + public ChannelProperties() {} }