2
0

IWebSocket.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4. namespace MediaBrowser.Common.Net
  5. {
  6. /// <summary>
  7. /// Interface IWebSocket
  8. /// </summary>
  9. public interface IWebSocket : IDisposable
  10. {
  11. /// <summary>
  12. /// Gets or sets the state.
  13. /// </summary>
  14. /// <value>The state.</value>
  15. WebSocketState State { get; }
  16. /// <summary>
  17. /// Gets or sets the receive action.
  18. /// </summary>
  19. /// <value>The receive action.</value>
  20. Action<byte[]> OnReceiveDelegate { get; set; }
  21. /// <summary>
  22. /// Sends the async.
  23. /// </summary>
  24. /// <param name="bytes">The bytes.</param>
  25. /// <param name="type">The type.</param>
  26. /// <param name="endOfMessage">if set to <c>true</c> [end of message].</param>
  27. /// <param name="cancellationToken">The cancellation token.</param>
  28. /// <returns>Task.</returns>
  29. Task SendAsync(byte[] bytes, WebSocketMessageType type, bool endOfMessage, CancellationToken cancellationToken);
  30. }
  31. }