public static Task <TimeSpan> WaitForState(this AblyRealtime realtime, ConnectionState awaitedState) { if (realtime.Connection.State == awaitedState) { return(Task.FromResult(TimeSpan.Zero)); } var connectionAwaiter = new ConnectionAwaiter(realtime.Connection, awaitedState); return(connectionAwaiter.Wait()); }
public static Task WaitForState(this IRealtimeClient realtime, ConnectionState awaitedState = ConnectionState.Connected) { var connectionAwaiter = new ConnectionAwaiter(realtime.Connection, awaitedState); return(connectionAwaiter.Wait()); }