2018-09-12 17:26:21 +00:00
|
|
|
|
using System;
|
2019-01-13 19:22:00 +00:00
|
|
|
|
using System.Net.WebSockets;
|
2013-02-21 01:33:05 +00:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2018-09-12 17:26:21 +00:00
|
|
|
|
namespace Emby.Server.Implementations.Net
|
2013-02-21 01:33:05 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface IWebSocket
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IWebSocket : IDisposable
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2014-05-17 18:37:40 +00:00
|
|
|
|
/// Occurs when [closed].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<EventArgs> Closed;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2013-02-21 01:33:05 +00:00
|
|
|
|
/// 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
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the async.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bytes">The bytes.</param>
|
|
|
|
|
/// <param name="endOfMessage">if set to <c>true</c> [end of message].</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-07-20 04:46:29 +00:00
|
|
|
|
Task SendAsync(byte[] bytes, bool endOfMessage, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the asynchronous.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="text">The text.</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(string text, bool endOfMessage, CancellationToken cancellationToken);
|
2013-02-21 01:33:05 +00:00
|
|
|
|
}
|
2018-09-12 17:26:21 +00:00
|
|
|
|
|
|
|
|
|
public interface IMemoryWebSocket
|
|
|
|
|
{
|
|
|
|
|
Action<Memory<byte>, int> OnReceiveMemoryBytes { get; set; }
|
|
|
|
|
}
|
2013-02-21 01:33:05 +00:00
|
|
|
|
}
|