using System;
using System.Threading;
using System.Threading.Tasks;
using System.Net.WebSockets;
namespace Emby.Server.Implementations.Net
{
    /// 
    /// Interface IWebSocket
    /// 
    public interface IWebSocket : IDisposable
    {
        /// 
        /// Occurs when [closed].
        /// 
        event EventHandler Closed;
        /// 
        /// Gets or sets the state.
        /// 
        /// The state.
        WebSocketState State { get; }
        /// 
        /// Gets or sets the receive action.
        /// 
        /// The receive action.
        Action OnReceiveBytes { get; set; }
        /// 
        /// Sends the async.
        /// 
        /// The bytes.
        /// if set to true [end of message].
        /// The cancellation token.
        /// Task.
        Task SendAsync(byte[] bytes, bool endOfMessage, CancellationToken cancellationToken);
        /// 
        /// Sends the asynchronous.
        /// 
        /// The text.
        /// if set to true [end of message].
        /// The cancellation token.
        /// Task.
        Task SendAsync(string text, bool endOfMessage, CancellationToken cancellationToken);
    }
    public interface IMemoryWebSocket
    {
        Action, int> OnReceiveMemoryBytes { get; set; }
    }
}