2013-09-05 21:34:46 +00:00
|
|
|
|
using MediaBrowser.Model.Net;
|
|
|
|
|
using System;
|
2013-02-21 01:33:05 +00:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Common.Net
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface IWebSocket
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IWebSocket : IDisposable
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the state.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The state.</value>
|
|
|
|
|
WebSocketState State { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the receive action.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The receive action.</value>
|
2013-09-05 21:34:46 +00:00
|
|
|
|
Action<byte[]> OnReceiveBytes { get; set; }
|
2013-02-21 01:33:05 +00:00
|
|
|
|
|
2013-09-05 21:34:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the on receive.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The on receive.</value>
|
|
|
|
|
Action<string> OnReceive { get; set; }
|
|
|
|
|
|
2013-02-21 01:33:05 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the async.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bytes">The bytes.</param>
|
|
|
|
|
/// <param name="type">The type.</param>
|
|
|
|
|
/// <param name="endOfMessage">if set to <c>true</c> [end of message].</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task SendAsync(byte[] bytes, WebSocketMessageType type, bool endOfMessage, CancellationToken cancellationToken);
|
|
|
|
|
}
|
|
|
|
|
}
|