using MediaBrowser.Model.Net;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Net
{
public interface IWebSocketConnection : IDisposable
{
///
/// Occurs when [closed].
///
event EventHandler Closed;
///
/// Gets the id.
///
/// The id.
Guid Id { get; }
///
/// Gets the last activity date.
///
/// The last activity date.
DateTime LastActivityDate { get; }
///
/// Gets or sets the receive action.
///
/// The receive action.
Action OnReceive { get; set; }
///
/// Gets the state.
///
/// The state.
WebSocketState State { get; }
///
/// Gets the remote end point.
///
/// The remote end point.
string RemoteEndPoint { get; }
///
/// Sends a message asynchronously.
///
///
/// The message.
/// The cancellation token.
/// Task.
/// message
Task SendAsync(WebSocketMessage message, CancellationToken cancellationToken);
///
/// Sends a message asynchronously.
///
/// The buffer.
/// The cancellation token.
/// Task.
Task SendAsync(byte[] buffer, CancellationToken cancellationToken);
///
/// Sends a message asynchronously.
///
/// The text.
/// The cancellation token.
/// Task.
/// buffer
Task SendAsync(string text, CancellationToken cancellationToken);
}
}