connect to socket with access token

This commit is contained in:
Luke Pulverenti
2015-03-08 15:48:30 -04:00
parent 55c47e50fc
commit ccb2dda358
13 changed files with 247 additions and 21 deletions

View File

@@ -44,6 +44,11 @@ namespace MediaBrowser.Controller.Net
/// </summary>
event EventHandler<WebSocketConnectEventArgs> WebSocketConnected;
/// <summary>
/// Occurs when [web socket connecting].
/// </summary>
event EventHandler<WebSocketConnectingEventArgs> WebSocketConnecting;
/// <summary>
/// Inits this instance.
/// </summary>

View File

@@ -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
/// </summary>
/// <value>The web socket connections.</value>
IEnumerable<IWebSocketConnection> WebSocketConnections { get; }
/// <summary>
/// Occurs when [web socket connected].
/// </summary>
event EventHandler<GenericEventArgs<IWebSocketConnection>> WebSocketConnected;
}
}

View File

@@ -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].
/// </summary>
event EventHandler<EventArgs> Closed;
/// <summary>
/// Gets the id.
/// </summary>
@@ -24,6 +25,17 @@ namespace MediaBrowser.Controller.Net
/// <value>The last activity date.</value>
DateTime LastActivityDate { get; }
/// <summary>
/// Gets or sets the URL.
/// </summary>
/// <value>The URL.</value>
string Url { get; set; }
/// <summary>
/// Gets or sets the query string.
/// </summary>
/// <value>The query string.</value>
NameValueCollection QueryString { get; set; }
/// <summary>
/// Gets or sets the receive action.
/// </summary>

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Specialized;
namespace MediaBrowser.Controller.Net
{
@@ -7,6 +8,16 @@ namespace MediaBrowser.Controller.Net
/// </summary>
public class WebSocketConnectEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the URL.
/// </summary>
/// <value>The URL.</value>
public string Url { get; set; }
/// <summary>
/// Gets or sets the query string.
/// </summary>
/// <value>The query string.</value>
public NameValueCollection QueryString { get; set; }
/// <summary>
/// Gets or sets the web socket.
/// </summary>
@@ -18,4 +29,35 @@ namespace MediaBrowser.Controller.Net
/// <value>The endpoint.</value>
public string Endpoint { get; set; }
}
public class WebSocketConnectingEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the URL.
/// </summary>
/// <value>The URL.</value>
public string Url { get; set; }
/// <summary>
/// Gets or sets the endpoint.
/// </summary>
/// <value>The endpoint.</value>
public string Endpoint { get; set; }
/// <summary>
/// Gets or sets the query string.
/// </summary>
/// <value>The query string.</value>
public NameValueCollection QueryString { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [allow connection].
/// </summary>
/// <value><c>true</c> if [allow connection]; otherwise, <c>false</c>.</value>
public bool AllowConnection { get; set; }
public WebSocketConnectingEventArgs()
{
QueryString = new NameValueCollection();
AllowConnection = true;
}
}
}