< Summary - Kestrun — Combined Coverage

Information
Class: Public.Middleware.Add-KrSignalRHubMiddleware
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Middleware/Add-KrSignalRHubMiddleware.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 4
Coverable lines: 4
Total lines: 48
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

Coverage history

Coverage history 0 25 50 75 100 09/13/2025 - 17:19:56 Line coverage: 0% (0/13) Total lines: 87 Tag: Kestrun/Kestrun@ea635f1ee1937c260a89d1a43a3c203cd8767c7b10/13/2025 - 16:52:37 Line coverage: 0% (0/11) Total lines: 83 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e10/15/2025 - 21:27:26 Line coverage: 0% (0/4) Total lines: 48 Tag: Kestrun/Kestrun@c33ec02a85e4f8d6061aeaab5a5e8c3a8b665594

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Middleware/Add-KrSignalRHubMiddleware.ps1

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Maps a SignalR hub class to the given URL path.
 4    .DESCRIPTION
 5        This function allows you to map a SignalR hub class to a specific URL path on the Kestrun server.
 6    .PARAMETER Server
 7        The Kestrun server instance to which the SignalR hub will be added.
 8    .PARAMETER Path
 9        The URL path where the SignalR hub will be accessible. Defaults to '/hubs/kestrun'.
 10    .PARAMETER PassThru
 11        If specified, the cmdlet will return the modified server instance after adding the SignalR hub.
 12    .EXAMPLE
 13        Add-KrSignalRHubMiddleware -Path '/hubs/notifications' -PassThru
 14        Adds a SignalR hub at the path '/hubs/notifications' and returns the modified server instance.
 15    .NOTES
 16        This function is part of the Kestrun PowerShell module and is used to manage SignalR hubs on the Kestrun server.
 17        The Server parameter accepts a KestrunHost instance; if not provided, the default server is used.
 18        The Path parameter specifies the URL path where the SignalR hub will be accessible.
 19        The PassThru switch allows the function to return the modified server instance for further use.
 20#>
 21function Add-KrSignalRHubMiddleware {
 22    [KestrunRuntimeApi('Definition')]
 23    [CmdletBinding()]
 24    param(
 25        [Parameter(ValueFromPipeline)]
 26        [Kestrun.Hosting.KestrunHost]$Server,
 27
 28        [Parameter(Mandatory = $false)]
 29        [string]$Path = '/hubs/kestrun',
 30
 31        [Parameter()]
 32        [switch]$PassThru
 33    )
 34    begin {
 35        # Ensure the server instance is resolved
 036        $Server = Resolve-KestrunServer -Server $Server
 37    }
 38    process {
 39
 040        $server.AddSignalR($Path) | Out-Null
 41
 042        if ($PassThru.IsPresent) {
 43            # if the PassThru switch is specified, return the modified server instance
 044            return $Server
 45        }
 46    }
 47}
 48

Methods/Properties

Add-KrSignalRHubMiddleware()