diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-10-13 16:14:53 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-10-13 16:14:53 -0400 |
| commit | ab3c26c5647a56e95d0f5229f07b1a1b45812ff8 (patch) | |
| tree | bbcaf5db256364f19cdb4f7c18eb82171dc4183b /MediaBrowser.Model/ApiClient/IClientWebSocket.cs | |
| parent | 8a15ee6ab4149cf59f8ff2724e3e415d34557da1 (diff) | |
update connect
Diffstat (limited to 'MediaBrowser.Model/ApiClient/IClientWebSocket.cs')
| -rw-r--r-- | MediaBrowser.Model/ApiClient/IClientWebSocket.cs | 54 |
1 files changed, 54 insertions, 0 deletions
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 +{ + /// <summary> + /// Interface IClientWebSocket + /// </summary> + public interface IClientWebSocket : IDisposable + { + /// <summary> + /// Occurs when [closed]. + /// </summary> + event EventHandler Closed; + + /// <summary> + /// Gets or sets the state. + /// </summary> + /// <value>The state.</value> + WebSocketState State { get; } + + /// <summary> + /// Connects the async. + /// </summary> + /// <param name="url">The URL.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task.</returns> + Task ConnectAsync(string url, CancellationToken cancellationToken); + + /// <summary> + /// Gets or sets the receive action. + /// </summary> + /// <value>The receive action.</value> + Action<byte[]> OnReceiveBytes { get; set; } + + /// <summary> + /// Gets or sets the on receive. + /// </summary> + /// <value>The on receive.</value> + Action<string> OnReceive { get; set; } + + /// <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); + } +} |
