// // IServer.cs // // Copyright (c) František Boháček. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.ComponentModel; using Remora.Results; namespace NosSmooth.Comms.Data; /// /// An abstraction for a server. /// public interface IServer { /// /// Gets the clients connected to the server. /// public IReadOnlyList Clients { get; } /// /// Listen for a new connection and wait for it. /// /// The cancellation token for cancelling the operation. /// A client connection, returned after the client has connected. public Task> WaitForConnectionAsync(CancellationToken ct = default); /// /// Start the server. /// /// The token used for stopping the server. may also be used. /// A result that may or may not have succeeded. public Task ListenAsync(CancellationToken stopToken = default); /// /// Close all connections, stop listening. /// public void Close(); }