IWebSocket.cs 1.1 KB

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