You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.1 KiB
32 lines
1.1 KiB
12 years ago
|
using System.Collections.Generic;
|
||
12 years ago
|
using Microsoft.AspNet.SignalR;
|
||
|
using NzbDrone.Api.SignalR;
|
||
12 years ago
|
using NzbDrone.Common.Composition;
|
||
12 years ago
|
using Owin;
|
||
|
|
||
12 years ago
|
namespace NzbDrone.Host.Owin.MiddleWare
|
||
12 years ago
|
{
|
||
|
public class SignalRMiddleWare : IOwinMiddleWare
|
||
|
{
|
||
12 years ago
|
private readonly IEnumerable<NzbDronePersistentConnection> _persistentConnections;
|
||
12 years ago
|
|
||
12 years ago
|
public int Order { get { return 0; } }
|
||
|
|
||
12 years ago
|
public SignalRMiddleWare(IEnumerable<NzbDronePersistentConnection> persistentConnections, IContainer container)
|
||
12 years ago
|
{
|
||
12 years ago
|
_persistentConnections = persistentConnections;
|
||
|
|
||
|
SignalrDependencyResolver.Register(container);
|
||
12 years ago
|
}
|
||
|
|
||
|
public void Attach(IAppBuilder appBuilder)
|
||
|
{
|
||
12 years ago
|
foreach (var nzbDronePersistentConnection in _persistentConnections)
|
||
|
{
|
||
12 years ago
|
var url = string.Format("signalr/{0}", nzbDronePersistentConnection.Resource.Trim('/'));
|
||
|
appBuilder.MapConnection(url, nzbDronePersistentConnection.GetType(), new ConnectionConfiguration { EnableCrossDomain = true });
|
||
12 years ago
|
}
|
||
|
|
||
12 years ago
|
}
|
||
|
}
|
||
|
}
|