Skip to content

Commit

Permalink
Merge pull request #1247 from ably/fix/connection-state-ttl
Browse files Browse the repository at this point in the history
Updated connectionTtl to be 120 seconds
  • Loading branch information
sacOO7 authored Jul 10, 2023
2 parents 06111d7 + 00d0777 commit d7abbde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/IO.Ably.Shared/Defaults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 8 additions & 2 deletions src/IO.Ably.Tests.Shared/Realtime/ConnectionSandBoxSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit d7abbde

Please sign in to comment.