using MediaBrowser.Model.Net;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Model.ApiClient
{
    /// 
    /// Interface IClientWebSocket
    /// 
    public interface IClientWebSocket : IDisposable
    {
        /// 
        /// Occurs when [closed].
        /// 
        event EventHandler Closed;
        /// 
        /// Gets or sets the state.
        /// 
        /// The state.
        WebSocketState State { get; }
        /// 
        /// Connects the async.
        /// 
        /// The URL.
        /// The cancellation token.
        /// Task.
        Task ConnectAsync(string url, CancellationToken cancellationToken);
        /// 
        /// Gets or sets the receive action.
        /// 
        /// The receive action.
        Action OnReceiveBytes { get; set; }
        /// 
        /// Gets or sets the on receive.
        /// 
        /// The on receive.
        Action OnReceive { get; set; }
        /// 
        /// Sends the async.
        /// 
        /// The bytes.
        /// The type.
        /// if set to true [end of message].
        /// The cancellation token.
        /// Task.
        Task SendAsync(byte[] bytes, WebSocketMessageType type, bool endOfMessage, CancellationToken cancellationToken);
    }
}