Class UriHttpListenerExtensions
Async helpers for the HttpListener
Inheritance
System.Object
UriHttpListenerExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Dapplo.HttpExtensions.Listener
Assembly: Dapplo.HttpExtensions.dll
Syntax
public static class UriHttpListenerExtensions
Methods
| Improve this Doc View SourceListenAsync<T>(Uri, Func<HttpListenerContext, Task<T>>, CancellationToken)
This method starts a HttpListener to make it possible to listen async for a SINGLE request.
Declaration
public static Task<T> ListenAsync<T>(this Uri listenUri, Func<HttpListenerContext, Task<T>> httpListenerContextHandler, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Uri | listenUri | The Uri to listen to, use CreateFreeLocalHostUri (and add segments) if you don't have a specific reason |
Func<HttpListenerContext, Task<T>> | httpListenerContextHandler | A function which gets a HttpListenerContext and returns a value |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<T> | The value from the httpListenerContextHandler |
Type Parameters
Name | Description |
---|---|
T |