From ccb2dda358a54810d940c0c7ddceb255a82ae947 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 8 Mar 2015 15:48:30 -0400 Subject: connect to socket with access token --- MediaBrowser.Controller/Net/IHttpServer.cs | 5 +++ MediaBrowser.Controller/Net/IServerManager.cs | 7 +++- .../Net/IWebSocketConnection.cs | 14 +++++++- .../Net/WebSocketConnectEventArgs.cs | 42 ++++++++++++++++++++++ 4 files changed, 66 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Controller/Net') diff --git a/MediaBrowser.Controller/Net/IHttpServer.cs b/MediaBrowser.Controller/Net/IHttpServer.cs index 315b48b83..37142af19 100644 --- a/MediaBrowser.Controller/Net/IHttpServer.cs +++ b/MediaBrowser.Controller/Net/IHttpServer.cs @@ -44,6 +44,11 @@ namespace MediaBrowser.Controller.Net /// event EventHandler WebSocketConnected; + /// + /// Occurs when [web socket connecting]. + /// + event EventHandler WebSocketConnecting; + /// /// Inits this instance. /// diff --git a/MediaBrowser.Controller/Net/IServerManager.cs b/MediaBrowser.Controller/Net/IServerManager.cs index d90a0f8ed..5191a62e3 100644 --- a/MediaBrowser.Controller/Net/IServerManager.cs +++ b/MediaBrowser.Controller/Net/IServerManager.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Common.Net; +using MediaBrowser.Model.Events; using System; using System.Collections.Generic; using System.Threading; @@ -58,5 +58,10 @@ namespace MediaBrowser.Controller.Net /// /// The web socket connections. IEnumerable WebSocketConnections { get; } + + /// + /// Occurs when [web socket connected]. + /// + event EventHandler> WebSocketConnected; } } \ No newline at end of file diff --git a/MediaBrowser.Controller/Net/IWebSocketConnection.cs b/MediaBrowser.Controller/Net/IWebSocketConnection.cs index 37fd6708d..e21df3c39 100644 --- a/MediaBrowser.Controller/Net/IWebSocketConnection.cs +++ b/MediaBrowser.Controller/Net/IWebSocketConnection.cs @@ -1,5 +1,6 @@ using MediaBrowser.Model.Net; using System; +using System.Collections.Specialized; using System.Threading; using System.Threading.Tasks; @@ -11,7 +12,7 @@ namespace MediaBrowser.Controller.Net /// Occurs when [closed]. /// event EventHandler Closed; - + /// /// Gets the id. /// @@ -24,6 +25,17 @@ namespace MediaBrowser.Controller.Net /// 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. + NameValueCollection QueryString { get; set; } + /// /// Gets or sets the receive action. /// diff --git a/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs b/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs index 394fcd92f..ffeaf286e 100644 --- a/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs +++ b/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Specialized; namespace MediaBrowser.Controller.Net { @@ -7,6 +8,16 @@ namespace MediaBrowser.Controller.Net /// public class WebSocketConnectEventArgs : EventArgs { + /// + /// Gets or sets the URL. + /// + /// The URL. + public string Url { get; set; } + /// + /// Gets or sets the query string. + /// + /// The query string. + public NameValueCollection QueryString { get; set; } /// /// Gets or sets the web socket. /// @@ -18,4 +29,35 @@ namespace MediaBrowser.Controller.Net /// The endpoint. public string Endpoint { get; set; } } + + public class WebSocketConnectingEventArgs : EventArgs + { + /// + /// Gets or sets the URL. + /// + /// The URL. + public string Url { get; set; } + /// + /// Gets or sets the endpoint. + /// + /// The endpoint. + public string Endpoint { get; set; } + /// + /// Gets or sets the query string. + /// + /// The query string. + public NameValueCollection QueryString { get; set; } + /// + /// Gets or sets a value indicating whether [allow connection]. + /// + /// true if [allow connection]; otherwise, false. + public bool AllowConnection { get; set; } + + public WebSocketConnectingEventArgs() + { + QueryString = new NameValueCollection(); + AllowConnection = true; + } + } + } -- cgit v1.2.3