diff --git a/src/IO.Ably.Shared/Defaults.cs b/src/IO.Ably.Shared/Defaults.cs index c32dde171..f712d890f 100644 --- a/src/IO.Ably.Shared/Defaults.cs +++ b/src/IO.Ably.Shared/Defaults.cs @@ -45,8 +45,8 @@ internal static string GetVersion() public static readonly TimeSpan RealtimeRequestTimeout = TimeSpan.FromSeconds(10); public static readonly TimeSpan DisconnectedRetryTimeout = TimeSpan.FromSeconds(15); public static readonly TimeSpan SuspendedRetryTimeout = TimeSpan.FromSeconds(30); - public static readonly TimeSpan ConnectionStateTtl = TimeSpan.FromSeconds(60); - public static readonly TimeSpan FallbackRetryTimeout = TimeSpan.FromMinutes(10); // https://docs.ably.com/client-lib-development-guide/features/#TO3l10 + public static readonly TimeSpan ConnectionStateTtl = TimeSpan.FromSeconds(120); // https://sdk.ably.com/builds/ably/specification/main/features/#DF1a + public static readonly TimeSpan FallbackRetryTimeout = TimeSpan.FromMinutes(10); // https://sdk.ably.com/builds/ably/specification/main/features/#TO3l10 public static readonly ITransportFactory WebSocketTransportFactory = IoC.TransportFactory; diff --git a/src/IO.Ably.Tests.Shared/Realtime/ConnectionSandBoxSpecs.cs b/src/IO.Ably.Tests.Shared/Realtime/ConnectionSandBoxSpecs.cs index de27d73d8..7e872b37a 100644 --- a/src/IO.Ably.Tests.Shared/Realtime/ConnectionSandBoxSpecs.cs +++ b/src/IO.Ably.Tests.Shared/Realtime/ConnectionSandBoxSpecs.cs @@ -85,11 +85,17 @@ public async Task WhenClosingAConnection_ItShouldRaiseClosingAndClosedEvents(Pro [ProtocolData] public async Task ShouldSaveConnectionStateTtlToConnectionObject(Protocol protocol) { - var client = await GetRealtimeClient(protocol); + var client = await GetRealtimeClient(protocol, (options, _) => options.AutoConnect = false); + client.State.Connection.ConnectionStateTtl = TimeSpan.FromSeconds(60); + client.State.Connection.ConnectionStateTtl.Should().Be(TimeSpan.FromSeconds(60)); + client.Connection.ConnectionStateTtl.Should().Be(TimeSpan.FromSeconds(60)); + client.Connect(); await WaitForState(client); - client.Connection.ConnectionStateTtl.Should().NotBe(Defaults.ConnectionStateTtl); + var connectMessage = client.GetTestTransport().ProtocolMessagesReceived.First(msg => msg.Action == ProtocolMessage.MessageAction.Connected); + connectMessage.ConnectionDetails.ConnectionStateTtl.Should().Be(TimeSpan.FromMinutes(2)); + client.Connection.ConnectionStateTtl.Should().Be(TimeSpan.FromMinutes(2)); } [Theory]