From ab3c26c5647a56e95d0f5229f07b1a1b45812ff8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 13 Oct 2014 16:14:53 -0400 Subject: update connect --- MediaBrowser.Model/ApiClient/IClientWebSocket.cs | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 MediaBrowser.Model/ApiClient/IClientWebSocket.cs (limited to 'MediaBrowser.Model/ApiClient/IClientWebSocket.cs') diff --git a/MediaBrowser.Model/ApiClient/IClientWebSocket.cs b/MediaBrowser.Model/ApiClient/IClientWebSocket.cs new file mode 100644 index 000000000..ca3a761d4 --- /dev/null +++ b/MediaBrowser.Model/ApiClient/IClientWebSocket.cs @@ -0,0 +1,54 @@ +using MediaBrowser.Model.Net; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Model.ApiClient +{ + /// + /// Interface IClientWebSocket + /// + public interface IClientWebSocket : IDisposable + { + /// + /// Occurs when [closed]. + /// + event EventHandler Closed; + + /// + /// Gets or sets the state. + /// + /// The state. + WebSocketState State { get; } + + /// + /// Connects the async. + /// + /// The URL. + /// The cancellation token. + /// Task. + Task ConnectAsync(string url, CancellationToken cancellationToken); + + /// + /// Gets or sets the receive action. + /// + /// The receive action. + Action OnReceiveBytes { get; set; } + + /// + /// Gets or sets the on receive. + /// + /// The on receive. + Action OnReceive { get; set; } + + /// + /// Sends the async. + /// + /// The bytes. + /// The type. + /// if set to true [end of message]. + /// The cancellation token. + /// Task. + Task SendAsync(byte[] bytes, WebSocketMessageType type, bool endOfMessage, CancellationToken cancellationToken); + } +} -- cgit v1.2.3