// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
namespace Microsoft.AspNetCore.SignalR.Client
{
///
/// A factory abstraction for creating connections to a SignalR server.
///
public interface IConnectionFactory
{
///
/// Creates a new connection to a SignalR server using the specified .
///
/// The transfer format the connection should use.
/// The token to monitor for cancellation requests. The default value is .
///
/// A that represents the asynchronous connect.
/// The property returns a for the new connection.
///
Task ConnectAsync(TransferFormat transferFormat, CancellationToken cancellationToken = default);
// Current plan for IAsyncDisposable is that DisposeAsync will NOT take a CancellationToken
// https://github.com/dotnet/csharplang/blob/195efa07806284d7b57550e7447dc8bd39c156bf/proposals/async-streams.md#iasyncdisposable
///
/// Disposes the specified .
///
/// The connection to dispose.
/// A that represents the asynchronous dispose.
Task DisposeAsync(ConnectionContext connection);
}
}