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