Interface IHttpRequestContext
Defines the contract for an HTTP request context containing request, response, and WebSocket support.
public interface IHttpRequestContext
Properties
IsWebSocketRequest
Gets a value indicating whether this is a WebSocket upgrade request.
bool IsWebSocketRequest { get; }
Property Value
Received
Gets or sets the timestamp when the request was received.
DateTime Received { get; set; }
Property Value
Request
Gets or sets the HTTP request.
IHttpRequest Request { get; set; }
Property Value
Response
Gets or sets the HTTP response.
IHttpResponse Response { get; set; }
Property Value
WebSocketRequestedProtocols
Gets the list of WebSocket sub-protocols requested by the client.
IList<string> WebSocketRequestedProtocols { get; }
Property Value
Methods
AcceptWebSocketAsync(string)
Accepts a WebSocket connection with the specified sub-protocol.
Task<WebSocket> AcceptWebSocketAsync(string subProtocol)
Parameters
subProtocolstringThe WebSocket sub-protocol to use, or null for no sub-protocol.
Returns
Release()
Releases the request context and completes the response.
void Release()
WaitAsync()
Waits asynchronously for the request processing to complete.
Task WaitAsync()
Returns
- Task
A task representing the asynchronous wait operation.