+When working within a SignalR hub, you can access the <xref:Microsoft.AspNetCore.Http.HttpContext> directly using the <xref:Microsoft.AspNetCore.SignalR.GetHttpContextExtensions.GetHttpContext%2A?displayProperty=nameWithType> method. This method returns the <xref:Microsoft.AspNetCore.Http.HttpContext> for the current connection or `null` if the connection isn't associated with an HTTP request. This is particularly useful for retrieving HTTP connection information, such as headers and query strings, directly within the hub. We recommend calling this method over <xref:Microsoft.AspNetCore.Http.IHttpContextAccessor> for accessing <xref:Microsoft.AspNetCore.Http.HttpContext> in the hub. For more information, see <xref:signalr/hubs#the-context-object>.
0 commit comments