KestrunContext record
Represents the context for a Kestrun request, including the request, response, HTTP context, and host.
public record KestrunContext
Public Members
| name | description |
|---|---|
| KestrunContext(…) | Initializes a new instance of the KestrunContext class. This constructor is used when creating a new KestrunContext from an existing HTTP context. It initializes the KestrunRequest and KestrunResponse based on the provided HttpContext (2 constructors) |
| Connection { get; } | Gets the connection information for the current HTTP context. |
| Ct { get; } | Gets the cancellation token that is triggered when the HTTP request is aborted. |
| HasSession { get; } | True if Session middleware is active for this request. |
| Host { get; set; } | The Kestrun host associated with this context. |
| HttpContext { get; set; } | The ASP.NET Core HTTP context associated with this Kestrun context. |
| Items { get; } | Gets the collection of key/value pairs associated with the current HTTP context. |
| Request { get; set; } | The Kestrun request associated with this context. |
| Response { get; set; } | The Kestrun response associated with this context. |
| Session { get; } | Returns the ASP.NET Core session if the Session middleware is active; otherwise null. |
| User { get; } | Gets the user associated with the current HTTP context. |
| BroadcastEvent(…) | Synchronous wrapper for BroadcastEventAsync. |
| BroadcastEventAsync(…) | Asynchronously broadcasts a custom event to all connected SignalR clients using the IRealtimeBroadcaster service. |
| BroadcastLog(…) | Synchronous wrapper for BroadcastLogAsync. |
| BroadcastLogAsync(…) | Asynchronously broadcasts a log message to all connected SignalR clients using the IRealtimeBroadcaster service. |
| BroadcastToGroup(…) | Synchronous wrapper for BroadcastToGroupAsync. |
| BroadcastToGroupAsync(…) | Asynchronously broadcasts a message to a specific group of SignalR clients using the IRealtimeBroadcaster service. |
| TryGetSession(…) | Try pattern to get session without exceptions. |
See Also
- namespace Kestrun.Models