Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
895c9bd
commit ebf5084
Showing
4 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Shoko.Server.Commands; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.SignalR; | ||
|
||
namespace Shoko.Server.API.SignalR | ||
{ | ||
public class EventEmitter | ||
{ | ||
public EventEmitter(IHubContext<EventsHub> hub) | ||
{ | ||
Hub = hub; | ||
} | ||
|
||
private IHubContext<EventsHub> Hub | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
public async Task QueueStateChanged(string queue, QueueStateEventArgs e) | ||
{ | ||
await Hub.Clients.All.SendAsync("QueueStateChanged", queue, e.QueueState.formatMessage()); | ||
} | ||
|
||
public async Task QueueCountChanged(string queue, QueueCountEventArgs e) | ||
{ | ||
await Hub.Clients.All.SendAsync("QueueCountChanged", queue, e.QueueCount); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters