using System;
using System.Net.WebSockets;
using System.Threading;
using System.Threading.Tasks;
namespace EmbedIO.WebSockets
{
///
///
/// Interface to create a WebSocket implementation.
///
///
public interface IWebSocket : IDisposable
{
///
/// Gets the state.
///
///
/// The state.
///
WebSocketState State { get; }
///
/// Sends the buffer to the web socket asynchronously.
///
/// The buffer.
/// if set to true [is text].
/// The cancellation token.
///
/// A task that represents the asynchronous of send data using websocket.
///
Task SendAsync(byte[] buffer, bool isText, CancellationToken cancellationToken = default);
///
/// Closes the web socket asynchronously.
///
/// The cancellation token.
///
/// The task object representing the asynchronous operation.
///
Task CloseAsync(CancellationToken cancellationToken = default);
///
/// Closes the web socket asynchronously.
///
/// The code.
/// The comment.
/// The cancellation token.
///
/// The task object representing the asynchronous operation.
///
Task CloseAsync(CloseStatusCode code, string? comment = null, CancellationToken cancellationToken = default);
}
}