tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
JobsHub.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.AspNetCore.SignalR;
4
9
11{
15 sealed class JobsHub : ConnectionMappingHub<JobsHub, IJobsHub>
16 {
22 public static string HubGroupName(long instanceId)
23 => $"instance-{instanceId}";
24
30 public static string HubGroupName(Job job)
31 {
32 ArgumentNullException.ThrowIfNull(job);
33
34 if (job.Instance == null)
35 throw new InvalidOperationException("job.Instance was null!");
36
37 return HubGroupName(job.Instance.Require(x => x.Id));
38 }
39
51 }
52}
A SignalR Hub for pushing job updates.
Definition JobsHub.cs:16
static string HubGroupName(Job job)
Get the group name for a given job .
Definition JobsHub.cs:30
static string HubGroupName(long instanceId)
Get the group name for a given instanceId .
JobsHub(IHubConnectionMapper< JobsHub, IJobsHub > connectionMapper, IAuthenticationContext authenticationContext)
Initializes a new instance of the JobsHub class.
Definition JobsHub.cs:45
Instance? Instance
The Models.Instance the job belongs to if any.
Definition Job.cs:32
Base class for Hub<T>s that want to map their connection IDs to Models.PermissionSets.
readonly IAuthenticationContext authenticationContext
The IAuthenticationContext for the ConnectionMappingHub<TChildHub, THubMethods>.
readonly IHubConnectionMapper< TChildHub, THubMethods > connectionMapper
The IHubConnectionMapper<THub, THubMethods> used to map connections.
For creating and accessing authentication contexts.
Handles mapping connection IDs to Users for a given THub .