Class HttpEndpointConnection
Base class for connections that access the control server via the Duet API using a UNIX socket
Implements
Inherited Members
Namespace: DuetWebServer.Middleware
Assembly: DuetWebServer.dll
Syntax
public sealed class HttpEndpointConnection : IDisposable
Properties
IsConnected
Returns true if the socket is still connected
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
Close()
Closes the current connection and disposes it
Declaration
public void Close()
Connect(string)
Establishes a connection to the given UNIX socket file
Declaration
public void Connect(string socketPath)
Parameters
Type | Name | Description |
---|---|---|
string | socketPath | Path to the UNIX socket file |
Exceptions
Type | Condition |
---|---|
IOException | Connection mode is unavailable |
Dispose()
Cleans up the current connection and all resources associated to it
Declaration
public void Dispose()
GetHttpResponse(CancellationToken)
Read a response to an HTTP request from the endpoint provider
Declaration
public Task<SendHttpResponse> GetHttpResponse(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional cancellation token |
Returns
Type | Description |
---|---|
Task<SendHttpResponse> | HTTP response to send |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | Operation has been cancelled |
SocketException | Connection has been closed |
GetPeerCredentials(out int, out int, out int)
Get the peer credentials of the UNIX socket
Declaration
public void GetPeerCredentials(out int pid, out int uid, out int gid)
Parameters
Type | Name | Description |
---|---|---|
int | pid | Process ID |
int | uid | User ID |
int | gid | Group ID |
SendHttpRequest(ReceivedHttpRequest, CancellationToken)
Send an HTTP request notification to the endpoint provider
Declaration
public Task SendHttpRequest(ReceivedHttpRequest httpRequest, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ReceivedHttpRequest | httpRequest | Received HTTP request |
CancellationToken | cancellationToken | Optional cancellation token |
Returns
Type | Description |
---|---|
Task | Asynchronous task |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | Operation has been cancelled |
SocketException | Connection has been closed |