Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK-3703] Upgrade library to protocol v2 #1199

Merged
merged 122 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
e083914
Removed recovery key and serials from realtime connection
sacOO7 Sep 6, 2022
e159a36
Added recovery context class to store recovery Key
sacOO7 Sep 14, 2022
b3c0a2a
Updated recoveryKeyContext, added json based encoder and decoder
sacOO7 Sep 17, 2022
43062fc
Added encode/decode tests for recoveryKeyContext
sacOO7 Sep 17, 2022
e2d725b
Added test to check for null recovery context for wrong options input
sacOO7 Sep 18, 2022
a29ef56
Upgraded protocol version number to 2.0 as per spec
sacOO7 Sep 18, 2022
92c2fbf
removed connection serial from ProtocolMessage and Connection class,
sacOO7 Sep 18, 2022
f76db07
Skipped test for checking lib version in sync with api/protocol version
sacOO7 Sep 19, 2022
ea76bc6
Updated failing connection serial tests
sacOO7 Sep 19, 2022
90aa68d
captured channel serial from ProtocolMessage in RealtimeChannel
sacOO7 Sep 21, 2022
267ce9e
Added a method to set channel serials from recover option
sacOO7 Sep 21, 2022
86e0673
Added impl for recovery key
sacOO7 Sep 21, 2022
44f685f
Set ProtocolMessage ChannelSerial before sending channel attach
sacOO7 Sep 21, 2022
1f7baaa
Added recoveryContext for transport and connectionManager
sacOO7 Sep 22, 2022
af07486
Set messageserial from recoveryKeyContext while passing it via options
sacOO7 Sep 22, 2022
c7a2e17
Updated recoveryKey to return null for non-connected states
sacOO7 Sep 23, 2022
125905a
Added test to check if recoverKey is set properly while initializing …
sacOO7 Sep 23, 2022
67d958d
Updated test for msg serial and channel serial
sacOO7 Sep 26, 2022
d6c90b0
Setting channel serial as null as per spec when channel goes into det…
sacOO7 Sep 26, 2022
6c86c3e
Updated presence enter as per new spec 2.0
sacOO7 Sep 26, 2022
8d2ae1f
Updated connection resume gracefully
sacOO7 Sep 26, 2022
399af27
Added relevant spec id's in the code
sacOO7 Sep 27, 2022
7be4842
Updated implementation for connected command
sacOO7 Sep 29, 2022
aa97c40
Moved channel serial under channel properties as per spec
sacOO7 Sep 29, 2022
aa7cd3e
Removed RTN15f as per test, updated test to be compatible with RTN15a
sacOO7 Sep 29, 2022
3b00321
Added warning level logging to RecoveryContext decoding
sacOO7 Sep 30, 2022
58d3dc4
Fixed test RTN16e, moved to resume spec as per RTN15c7, RTN15c4
sacOO7 Sep 30, 2022
d9a47ad
Set up auto member entry in the presence contructor on fresh channel …
sacOO7 Sep 30, 2022
32f7336
Refactored presence entry for channel attach
sacOO7 Oct 1, 2022
b68e89f
Removed RTP17c2 test as per updated spec, skipped issue 332 test
sacOO7 Oct 1, 2022
942fef6
Refactored recovery context test name
sacOO7 Oct 1, 2022
8280f2b
Fixed failing test for resume request and error
sacOO7 Oct 1, 2022
4dcee4f
Refactored tests, skipped few tests due to resume error/ different co…
sacOO7 Oct 2, 2022
9429bae
Added spec comment to channel attach for fresh resume/recover
sacOO7 Oct 2, 2022
b77a386
Fixed test for default protocol version
sacOO7 Oct 2, 2022
cc12e7b
Removed skipped tests with fixed protocol version
sacOO7 Oct 2, 2022
14e300d
Added skipped test for presence enter on channel attach
sacOO7 Oct 3, 2022
fe819ea
Enabled idempotent rest publishing by default
sacOO7 Oct 3, 2022
148ef16
Added attached check for storing channelSerials as per spec
sacOO7 Oct 4, 2022
16c366a
Updated internal map according to RTP17h
sacOO7 Oct 4, 2022
34daada
Added check for non empty channel serial before storing as channelSerial
sacOO7 Oct 5, 2022
39aa3c9
Simplified dotnet implementation for realtime channels, setting
sacOO7 Oct 7, 2022
0dae092
Updated GetRecoveryKey method, returning empty string for given
sacOO7 Oct 10, 2022
48ffe9f
Merge pull request #1183 from ably/feature/no-connection-serial
sacOO7 Oct 10, 2022
254f713
Rename getRecoveryKey->createRecoveryKey per updated spec
SimonWoolf Oct 31, 2022
19a09c0
Merge pull request #1185 from ably/create-recovery-key
SimonWoolf Nov 1, 2022
30cc05d
Updated protocol version to integer as per new spec
sacOO7 Jan 14, 2023
e98cdb1
Revert "Updated protocol version to integer as per new spec"
sacOO7 Jan 14, 2023
91d0385
Updated protocol version to integer as per new spec
sacOO7 Jan 14, 2023
af77ce4
Merge branch 'main' into feature/integration-2.0
sacOO7 Jan 15, 2023
bdcc322
Merge branch 'feature/integration-2.0' into update/integration-2.0
sacOO7 Jan 15, 2023
d2d702b
Added old recoverykey attribute, marked as deprecated
sacOO7 Jan 15, 2023
60aaeb0
Marked recoveryKey as property inside obsolete message
sacOO7 Jan 16, 2023
df383f3
Updated recoveryKey comment, added proper spec id
sacOO7 Jan 16, 2023
ad870a9
Merge pull request #1198 from ably/update/integration-2.0
sacOO7 Jan 16, 2023
338e378
Merge branch 'main' into feature/integration-2.0
sacOO7 Jul 13, 2023
a77822d
Refactored recoveryKeyContextSpec tests
sacOO7 Jul 19, 2023
82fb25a
Refactored tests, updated connectionRecoverySpecs assertion for msgSe…
sacOO7 Jul 19, 2023
86a23c0
Removed skip for failing test related to spec RTP17f
sacOO7 Jul 19, 2023
0f478f9
Removed unused connection serial errorString from the error codes
sacOO7 Jul 20, 2023
b5f2219
Refactored connection recovery spec tests
sacOO7 Jul 20, 2023
918d647
Marked test to be skipped because it somehow fails for last assertion
sacOO7 Jul 22, 2023
dab37f5
Removed unnecessary test for internal map
sacOO7 Jul 24, 2023
84b46c1
Moved recoveryKey test into a seaparate file with proper assertion in…
sacOO7 Jul 24, 2023
bd3d40f
Added explicit wait for connection messageserial check
sacOO7 Jul 24, 2023
32e48f3
Updated code to clear connection key and id in accordance with spec
sacOO7 Aug 2, 2023
d7ab8b8
Added spec annotation for presence methods
sacOO7 Aug 27, 2023
9857a59
Refactored code for internal presence map
sacOO7 Sep 2, 2023
0a889a2
Refactored error update emit for realtime channel
sacOO7 Sep 3, 2023
a3c76a7
Refactored presence code, removed unnecessary comments
sacOO7 Sep 3, 2023
8ccc633
Added spec annotations to presence impl
sacOO7 Sep 3, 2023
0a28b87
Simplified processing of sync and normal presence message
sacOO7 Sep 3, 2023
94b241a
Refactored onSyncMessage to have a separate sync related implementation
sacOO7 Sep 3, 2023
901df5e
Refactored onSyncMessage implementation under presence
sacOO7 Sep 3, 2023
e69a0c5
Removed unnecessary initial sync completed event handlers from the code
sacOO7 Sep 4, 2023
3714e94
Refactored presenceMap, removed unnecessary initial sync references
sacOO7 Sep 4, 2023
7a81620
Set sync as completed when ending presencemap sync
sacOO7 Sep 4, 2023
ccf20f9
Refactored channelSerial logic for starting sync
sacOO7 Sep 4, 2023
62a5e4d
Refactored sync complete, skipped failing presence sandbox test
sacOO7 Sep 4, 2023
905a3df
Simplified test for RTP1
sacOO7 Sep 5, 2023
faf4daf
Added missing spec annotations to presence
sacOO7 Sep 6, 2023
62a1405
Annotated code as per presence spec
sacOO7 Sep 6, 2023
8bf8ac0
Added test to enter local presence members when channel is attached
sacOO7 Sep 6, 2023
c0daf2e
Refactored realtimeworkflow for resume or recover success
sacOO7 Sep 7, 2023
ae75505
Updated connectionSpecs, setting messageserial to 45
sacOO7 Sep 7, 2023
46aa89b
Refactored presence internal map test for checking internal members
sacOO7 Sep 8, 2023
b250e61
Added extra buffer assert for incremental backoff and jitter connecti…
sacOO7 Sep 8, 2023
b83a9c9
Annotated connection resume and recovery spec
sacOO7 Sep 8, 2023
c121598
Added timeout of 2 seconds before checking for message serial
sacOO7 Sep 9, 2023
1e58fe7
Removed fixed build script dependency versions
sacOO7 Sep 9, 2023
0f43b53
Revert "Removed fixed build script dependency versions"
sacOO7 Sep 9, 2023
76fde65
Marked fixed versions for dotnet 6 and dotnet 7
sacOO7 Sep 10, 2023
201b196
Refactored code for resetting messageserial on explicit resume/recove…
sacOO7 Sep 10, 2023
6cba3e6
Updated package.yml package generation for explicit dotnet version
sacOO7 Sep 10, 2023
e6531a8
Added msbuild structuredlogger as a package dependency to build script
sacOO7 Sep 10, 2023
8e9ed4d
Updated workflow files to latest version of dotnet6 and dotnet 7
sacOO7 Sep 10, 2023
121d564
Refactored processing pending messages for failed resume/recover
sacOO7 Sep 11, 2023
435ff0c
Revert "Updated workflow files to latest version of dotnet6 and dotne…
sacOO7 Sep 11, 2023
99c997b
Revert "Added msbuild structuredlogger as a package dependency to bui…
sacOO7 Sep 11, 2023
33f77a4
Updated failing test, added reason for skipping the test
sacOO7 Sep 12, 2023
b7dd949
Downgraded dotnet6 versions because of logger issue
sacOO7 Sep 12, 2023
a85f3c6
Updated channelAttached presence logic for queuing messages
sacOO7 Sep 12, 2023
6b15097
Downgraded net 7.0 version across CI files
sacOO7 Sep 12, 2023
95d2917
Updated test for new channel attach on resume/recover connection
sacOO7 Sep 14, 2023
a5cd72c
Unskipped resume failure test for connection resume
sacOO7 Sep 14, 2023
eca05dd
Refactored connectionSandboxSpec tests, added channel level assertions
sacOO7 Sep 15, 2023
61dc64f
Fixed resume request with token auth error test, updated assertions
sacOO7 Sep 16, 2023
116d6e2
Moved recovery spec test under connectionRecoverySpec
sacOO7 Sep 16, 2023
0034372
Refactored connectionSandboxSpec tests, removed simulateLostConnection
sacOO7 Sep 16, 2023
52f3a93
Updated connection resume test for channel attach
sacOO7 Sep 17, 2023
2ef3c5f
Updated resume test for processing pending messages
sacOO7 Sep 17, 2023
ec739de
Removed tests that are not part of the spec, fixed flaky test
sacOO7 Sep 17, 2023
0e9918e
Added missing test for RTN15d, messages should be received after resu…
sacOO7 Sep 17, 2023
ce4a073
Added tests for processing ack/nack when resume success/failure
sacOO7 Sep 17, 2023
201feb1
updated ack/nack test to check for duplicates after resume success
sacOO7 Sep 18, 2023
4857065
Updated connectionSandbox tests for ack/nack
sacOO7 Sep 18, 2023
d0c20f8
Updated test for RTN16k, added channelserial assertions for conn. rec…
sacOO7 Sep 18, 2023
7236373
Updated test for RTN16k, added null recover key assertion
sacOO7 Sep 18, 2023
575f396
Added integration test/connectionSandboxTest for connection recovery
sacOO7 Sep 18, 2023
e212777
Merge branch 'main' into feature/integration-2.0
sacOO7 Sep 25, 2023
9386789
Refactored test for ack/nack to fail when connection goes into discon…
sacOO7 Sep 25, 2023
5507611
Merge branch 'feature/integration-2.0' of https://github.com/ably/abl…
sacOO7 Sep 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
with:
dotnet-version: |
3.1.x
6.0.x
7.0.x
6.0.403
7.0.100
- name: Download fake-cli
run: dotnet tool restore
- name: Package
Expand All @@ -45,8 +45,8 @@ jobs:
with:
dotnet-version: |
3.1.x
6.0.x
7.0.x
6.0.403
7.0.100
- name: Download fake-cli
run: dotnet tool install fake-cli --version 5.20.4 --tool-path .
- name: Restore packages
Expand All @@ -73,7 +73,7 @@ jobs:
with:
dotnet-version: |
2.x.x
6.x.x
6.0.403

# Checkout unity packager
- name: Checkout unity-packager repo
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tests-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
6.0.403
7.0.100

- name: Download dotnet build-script tools
run: dotnet tool restore
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tests-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
6.0.403
7.0.100

- name: Download dotnet build-script tools
run: dotnet tool restore
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
6.0.403
7.0.100

- name: Download dotnet build-script tools
run: dotnet tool restore
Expand Down
2 changes: 1 addition & 1 deletion src/IO.Ably.Shared/AblyRealtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal AblyRealtime(ClientOptions options, Func<ClientOptions, IMobileDevice,
RestClient = createRestFunc != null ? createRestFunc.Invoke(options, mobileDevice) : new AblyRest(options, mobileDevice);
Push = new PushRealtime(RestClient, Logger);

Connection = new Connection(this, options.NowFunc, options.Logger);
Connection = new Connection(this, options.NowFunc, Logger);
Connection.Initialise();

if (options.AutomaticNetworkStateMonitoring)
Expand Down
4 changes: 2 additions & 2 deletions src/IO.Ably.Shared/ClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ internal string GetClientId()
/// <summary>
/// A connection recovery string, specified by a client when initializing the library
/// with the intention of inheriting the state of an earlier connection. See the Ably
/// Realtime API documentation for further information on connection state recovery.
/// Realtime API documentation for further information on connection state recovery. (RTN16i)
/// Default: null.
/// </summary>
public string Recover { get; set; }
Expand Down Expand Up @@ -358,7 +358,7 @@ public bool UseBinaryProtocol
/// Default before 1.2: false.
/// Default from 1.2: true.
/// </summary>
public bool IdempotentRestPublishing { get; set; } = Defaults.ProtocolVersionNumber >= 1.2;
public bool IdempotentRestPublishing { get; set; } = true;

/// <summary>
/// Additional parameters to be sent in the querystring when initiating a realtime connection.
Expand Down
6 changes: 2 additions & 4 deletions src/IO.Ably.Shared/Defaults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

namespace IO.Ably
{
internal static class Defaults
internal class Defaults
{
internal static readonly float ProtocolVersionNumber = 1.2F;

internal static readonly string LibraryVersion = GetVersion();

internal static string GetVersion()
Expand All @@ -18,7 +16,7 @@ internal static string GetVersion()
return version.Split('.').Take(3).JoinStrings(".");
}

public static string ProtocolVersion { get; } = ProtocolVersionNumber.ToString(CultureInfo.InvariantCulture);
public const string ProtocolVersion = "2"; // CSV2

public const int QueryLimit = 100;

Expand Down
3 changes: 3 additions & 0 deletions src/IO.Ably.Shared/Extensions/PresenceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ public static bool IsSynthesized(this PresenceMessage msg)
return msg.Id == null || !msg.Id.StartsWith(msg.ConnectionId);
}

// RTP2b, RTP2c
public static bool IsNewerThan(this PresenceMessage thisMessage, PresenceMessage thatMessage)
{
// RTP2b1
if (thisMessage.IsSynthesized() || thatMessage.IsSynthesized())
{
return thisMessage.Timestamp > thatMessage.Timestamp;
}

// RTP2b2
var thisValues = thisMessage.Id.Split(':');
var thatValues = thatMessage.Id.Split(':');

Expand Down
2 changes: 1 addition & 1 deletion src/IO.Ably.Shared/Http/AblyHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ internal void SetPreferredHost(string currentHost)
internal void CreateInternalHttpClient(TimeSpan timeout, HttpMessageHandler messageHandler)
{
Client = messageHandler != null ? new HttpClient(messageHandler) : new HttpClient();
Client.DefaultRequestHeaders.Add("X-Ably-Version", Defaults.ProtocolVersion);
Client.DefaultRequestHeaders.Add("X-Ably-Version", Defaults.ProtocolVersion); // RSC7a
Client.DefaultRequestHeaders.Add(Agent.AblyAgentHeader, Agent.AblyAgentIdentifier(Options.Agents)); // RSC7d
Client.Timeout = timeout;
}
Expand Down
1 change: 1 addition & 0 deletions src/IO.Ably.Shared/IO.Ably.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Realtime\Presence.GetParams.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Realtime\Presence.QueuedPresenceMessage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Realtime\PresenceMap.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Realtime\RecoveryKeyContext.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Realtime\Workflows\ChannelCommands.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Realtime\Workflows\IQueueCommand.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Realtime\Workflows\PingRequest.cs" />
Expand Down
38 changes: 25 additions & 13 deletions src/IO.Ably.Shared/Realtime/ChannelMessageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,24 @@ public Task<bool> MessageReceived(ProtocolMessage protocolMessage, RealtimeState
return Task.FromResult(false);
}

// RTL15b
if (protocolMessage.ChannelSerial.IsNotEmpty() &&
(protocolMessage.Action == ProtocolMessage.MessageAction.Message ||
protocolMessage.Action == ProtocolMessage.MessageAction.Presence ||
protocolMessage.Action == ProtocolMessage.MessageAction.Attached))
{
Logger.Debug($"Setting channel serial for channelName - {channel.Name}," +
$"previous - {channel.Properties.ChannelSerial}, current - {protocolMessage.ChannelSerial}");
channel.Properties.ChannelSerial = protocolMessage.ChannelSerial;
}

switch (protocolMessage.Action)
{
case ProtocolMessage.MessageAction.Error:
channel.SetChannelState(ChannelState.Failed, protocolMessage);
break;
case ProtocolMessage.MessageAction.Attached:
channel.Properties.AttachSerial = protocolMessage.ChannelSerial;
channel.Properties.AttachSerial = protocolMessage.ChannelSerial; // RTL15a

if (protocolMessage.Flags.HasValue)
{
Expand All @@ -58,17 +69,15 @@ public Task<bool> MessageReceived(ProtocolMessage protocolMessage, RealtimeState
channel.Params = new ReadOnlyChannelParams(protocolMessage.Params);
}

if (channel.State == ChannelState.Attached)
// RTL12
if (channel.State == ChannelState.Attached && !protocolMessage.HasFlag(ProtocolMessage.Flag.Resumed))
{
// RTL12
if (!protocolMessage.HasFlag(ProtocolMessage.Flag.Resumed))
{
channel.Presence.ChannelAttached(protocolMessage);
channel.EmitUpdate(protocolMessage.Error, false, protocolMessage);
}
channel.Presence.ChannelAttached(protocolMessage, false);
channel.EmitErrorUpdate(protocolMessage.Error, false, protocolMessage);
}
else
{
channel.Presence.ChannelAttached(protocolMessage);
channel.SetChannelState(ChannelState.Attached, protocolMessage);
}

Expand Down Expand Up @@ -139,11 +148,14 @@ public Task<bool> MessageReceived(ProtocolMessage protocolMessage, RealtimeState
channel.OnError(presenceDecodeResult.Error);
}

string syncSerial = protocolMessage.Action == ProtocolMessage.MessageAction.Sync
? protocolMessage.ChannelSerial
: null;

channel.Presence.OnPresence(protocolMessage.Presence, syncSerial);
if (protocolMessage.Action == ProtocolMessage.MessageAction.Sync)
{
channel.Presence.OnSyncMessage(protocolMessage);
}
else
{
channel.Presence.OnPresence(protocolMessage.Presence);
}

break;
}
Expand Down
7 changes: 6 additions & 1 deletion src/IO.Ably.Shared/Realtime/ChannelProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
public class ChannelProperties
{
/// <summary>
/// contains the last channelSerial received in an ATTACHED ProtocolMessage for the channel, see RTL15a.
/// contains the channelSerial from latest ATTACHED ProtocolMessage received on the channel, see CP2a, RTL15a.
/// </summary>
public string AttachSerial { get; internal set; }

/// <summary>
/// contains the channelSerial from latest ProtocolMessage of action type Message/PresenceMessage received on the channel, see CP2b, RTL15b.
/// </summary>
public string ChannelSerial { get; internal set; }
}
}
38 changes: 25 additions & 13 deletions src/IO.Ably.Shared/Realtime/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading;
using System.Threading.Tasks;
using IO.Ably.Realtime.Workflow;
using IO.Ably.Shared.Realtime;
using IO.Ably.Transport;
using IO.Ably.Transport.States.Connection;

Expand Down Expand Up @@ -156,12 +157,6 @@ private void HandleNetworkStateChange(NetworkState state)
/// </summary>
public string Id => InnerState.Id;

/// <summary>
/// The serial number of the last message received on this connection.
/// The serial number may be used when recovering connection state.
/// </summary>
public long? Serial => InnerState.Serial;

internal long MessageSerial => InnerState.MessageSerial;

/// <summary>
Expand All @@ -172,18 +167,35 @@ private void HandleNetworkStateChange(NetworkState state)
/// <summary>
/// Indicates whether the current connection can be resumed.
/// </summary>
public bool ConnectionResumable => Key.IsNotEmpty() && Serial.HasValue;
public bool ConnectionResumable => Key.IsNotEmpty();

/// <summary>
/// Connection#recoveryKey is an attribute composed of the connectionKey, channelSerials, and the current msgSerial (RTN16m).
/// </summary>
[Obsolete("This property is deprecated, use CreateRecoveryKey method instead")]
public string RecoveryKey => CreateRecoveryKey();

/// <summary>
/// - (RTN16b) Connection#recoveryKey is an attribute composed of the connectionKey, and the latest connectionSerial received on the connection, and the current msgSerial.
/// Connection#CreateRecoveryKey is an attribute composed of the connectionKey, messageSerial and channelSerials (RTN16g, RTN16g1, RTN16h).
/// </summary>
public string RecoveryKey
/// <returns>recoveryKey.</returns>
public string CreateRecoveryKey()
{
get
if (Key.IsEmpty() || InnerState.State == Realtime.ConnectionState.Closing
|| InnerState.State == Realtime.ConnectionState.Closed
|| InnerState.State == Realtime.ConnectionState.Failed
|| InnerState.State == Realtime.ConnectionState.Suspended)
{
Debug.Assert(Serial.HasValue, "Expected a Value, found none");
return ConnectionResumable ? $"{Key}:{Serial.Value}:{MessageSerial}" : string.Empty;
return string.Empty;
}

var recoveryContext = new RecoveryKeyContext()
{
MsgSerial = MessageSerial,
ConnectionKey = Key,
ChannelSerials = RealtimeClient.Channels.GetChannelSerials(),
};
return recoveryContext.Encode();
}

/// <summary>
Expand All @@ -197,7 +209,7 @@ public string RecoveryKey
/// message and, in the failed state in particular, provides diagnostic
/// error information.
/// </summary>
public ErrorInfo ErrorReason => InnerState.ErrorReason;
public ErrorInfo ErrorReason => InnerState.ErrorReason; // RTN15c7

/// <summary>
/// Gets the currently used Host.
Expand Down
Loading
Loading