Fixed SignalR - Its FM!

pull/6/head
Mark McDowall 12 years ago
parent b73f7a02d7
commit eb42272764

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog; using NLog;
using Ninject;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
@ -19,6 +20,7 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public BacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob, public BacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
SeasonSearchJob seasonSearchJob, ConfigProvider configProvider) SeasonSearchJob seasonSearchJob, ConfigProvider configProvider)
{ {

@ -310,6 +310,7 @@
<Compile Include="Providers\DecisionEngine\AllowedReleaseGroupSpecification.cs" /> <Compile Include="Providers\DecisionEngine\AllowedReleaseGroupSpecification.cs" />
<Compile Include="Providers\DecisionEngine\CustomStartDateSpecification.cs" /> <Compile Include="Providers\DecisionEngine\CustomStartDateSpecification.cs" />
<Compile Include="Providers\DownloadClients\PneumaticProvider.cs" /> <Compile Include="Providers\DownloadClients\PneumaticProvider.cs" />
<Compile Include="Providers\Hubs\EpisodeHub.cs" />
<Compile Include="Providers\Indexer\NzbClub.cs" /> <Compile Include="Providers\Indexer\NzbClub.cs" />
<Compile Include="Providers\Indexer\NzbIndex.cs" /> <Compile Include="Providers\Indexer\NzbIndex.cs" />
<Compile Include="Providers\Indexer\FileSharingTalk.cs" /> <Compile Include="Providers\Indexer\FileSharingTalk.cs" />

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SignalR.Hubs;
namespace NzbDrone.Core.Providers.Hubs
{
public class EpisodeHub : Hub
{
}
}

@ -3,16 +3,15 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using NLog; using NLog;
using Ninject;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Providers.Hubs;
using SignalR; using SignalR;
using SignalR.Hosting.AspNet;
using SignalR.Hubs; using SignalR.Hubs;
using SignalR.Infrastructure;
namespace NzbDrone.Core.Providers namespace NzbDrone.Core.Providers
{ {
public class SignalRProvider : Hub public class SignalRProvider
{ {
private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private static readonly Logger logger = LogManager.GetCurrentClassLogger();
@ -22,7 +21,8 @@ namespace NzbDrone.Core.Providers
{ {
logger.Trace("Sending Status update to client. EpisodeId: {0}, Status: {1}", episodeId, episodeStatus); logger.Trace("Sending Status update to client. EpisodeId: {0}, Status: {1}", episodeId, episodeStatus);
Clients.updatedStatus(new var context = GlobalHost.ConnectionManager.GetHubContext<EpisodeHub>();
context.Clients.updatedStatus(new
{ {
EpisodeId = episodeId, EpisodeId = episodeId,
EpisodeStatus = episodeStatus.ToString(), EpisodeStatus = episodeStatus.ToString(),

@ -19,6 +19,7 @@ using ServiceStack.CacheAccess.Providers;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Web.Helpers.Binders; using NzbDrone.Web.Helpers.Binders;
using ServiceStack.ServiceInterface; using ServiceStack.ServiceInterface;
using SignalR;
namespace NzbDrone.Web namespace NzbDrone.Web
{ {
@ -71,6 +72,9 @@ namespace NzbDrone.Web
dispatch.Kernel.Load(Assembly.GetExecutingAssembly()); dispatch.Kernel.Load(Assembly.GetExecutingAssembly());
//SignalR
RouteTable.Routes.MapHubs();
//ServiceStack //ServiceStack
dispatch.Kernel.Bind<ICacheClient>().To<MemoryCacheClient>().InSingletonScope(); dispatch.Kernel.Bind<ICacheClient>().To<MemoryCacheClient>().InSingletonScope();
dispatch.Kernel.Bind<ISessionFactory>().To<SessionFactory>().InSingletonScope(); dispatch.Kernel.Bind<ISessionFactory>().To<SessionFactory>().InSingletonScope();

@ -66,10 +66,10 @@ function reloadGrid() {
//SignalR //SignalR
$(function () { $(function () {
// Proxy created on the fly // Proxy created on the fly
var signalRProvider = $.connection.signalRProvider; var episodeHub = $.connection.episodeHub;
// Declare a function on the chat hub so the server can invoke it // Declare a function on the chat hub so the server can invoke it
signalRProvider.updatedStatus = function (data) { episodeHub.updatedStatus = function (data) {
var row = $('[data-episode-id="' + data.EpisodeId + '"]'); var row = $('[data-episode-id="' + data.EpisodeId + '"]');
if (row.length == 0) if (row.length == 0)

Loading…
Cancel
Save