From a86b71899ec52c44ddc6c3018e8cc5e9d7ff4d62 Mon Sep 17 00:00:00 2001 From: Andrew Rabert Date: Thu, 27 Dec 2018 18:27:57 -0500 Subject: Add GPL modules --- .../Net/IWebSocketConnection.cs | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 MediaBrowser.Controller/Net/IWebSocketConnection.cs (limited to 'MediaBrowser.Controller/Net/IWebSocketConnection.cs') diff --git a/MediaBrowser.Controller/Net/IWebSocketConnection.cs b/MediaBrowser.Controller/Net/IWebSocketConnection.cs new file mode 100644 index 000000000..816e9afca --- /dev/null +++ b/MediaBrowser.Controller/Net/IWebSocketConnection.cs @@ -0,0 +1,85 @@ +using MediaBrowser.Model.Net; +using MediaBrowser.Model.Services; +using System.Net.WebSockets; +using System.Threading.Tasks; +using System.Threading; +using System; + +namespace MediaBrowser.Controller.Net +{ + public interface IWebSocketConnection : IDisposable + { + /// + /// Occurs when [closed]. + /// + event EventHandler Closed; + + /// + /// Gets the id. + /// + /// The id. + Guid Id { get; } + + /// + /// Gets the last activity date. + /// + /// The last activity date. + DateTime LastActivityDate { get; } + + /// + /// Gets or sets the URL. + /// + /// The URL. + string Url { get; set; } + /// + /// Gets or sets the query string. + /// + /// The query string. + QueryParamCollection QueryString { get; set; } + + /// + /// Gets or sets the receive action. + /// + /// The receive action. + Func OnReceive { get; set; } + + /// + /// Gets the state. + /// + /// The state. + WebSocketState State { get; } + + /// + /// Gets the remote end point. + /// + /// The remote end point. + string RemoteEndPoint { get; } + + /// + /// Sends a message asynchronously. + /// + /// + /// The message. + /// The cancellation token. + /// Task. + /// message + Task SendAsync(WebSocketMessage message, CancellationToken cancellationToken); + + /// + /// Sends a message asynchronously. + /// + /// The buffer. + /// The cancellation token. + /// Task. + Task SendAsync(byte[] buffer, CancellationToken cancellationToken); + + /// + /// Sends a message asynchronously. + /// + /// The text. + /// The cancellation token. + /// Task. + /// buffer + Task SendAsync(string text, CancellationToken cancellationToken); + } +} -- cgit v1.2.3