< Summary

Information
Class: Elsa.Workflows.Api.RealTime.Hubs.WorkflowInstanceHub
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/RealTime/Hubs/WorkflowInstanceHub.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 33
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
ObserveInstanceAsync()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/RealTime/Hubs/WorkflowInstanceHub.cs

#LineLine coverage
 1using Elsa.Workflows.Api.RealTime.Contracts;
 2using Elsa.Workflows.Runtime;
 3using JetBrains.Annotations;
 4using Microsoft.AspNetCore.Authorization;
 5using Microsoft.AspNetCore.SignalR;
 6
 7namespace Elsa.Workflows.Api.RealTime.Hubs;
 8
 9/// <summary>
 10/// Represents a SignalR hub for receiving workflow events on the client.
 11/// </summary>
 12[PublicAPI]
 13[Authorize]
 14public class WorkflowInstanceHub : Hub<IWorkflowInstanceClient>
 15{
 16    private readonly IWorkflowRuntime _workflowRuntime;
 17
 18    /// <inheritdoc />
 019    public WorkflowInstanceHub(IWorkflowRuntime workflowRuntime)
 20    {
 021        _workflowRuntime = workflowRuntime;
 022    }
 23
 24    /// <summary>
 25    /// Observes a workflow instance.
 26    /// </summary>
 27    /// <param name="instanceId">The ID of the workflow instance to observe.</param>
 28    public async Task ObserveInstanceAsync(string instanceId)
 29    {
 30        // Join the user to the workflow instance group.
 031        await Groups.AddToGroupAsync(Context.ConnectionId, instanceId);
 032    }
 33}