Class HttpClientRendezvousHttp
- Namespace
- Unity.Multiplayer.Core
IRendezvousHttp over HttpClient, which Unity's Mono and IL2CPP players support on desktop, mobile and Linux servers (not WebGL).
public sealed class HttpClientRendezvousHttp : IRendezvousHttp, IDisposable
- Inheritance
-
HttpClientRendezvousHttp
- Implements
- Inherited Members
Constructors
HttpClientRendezvousHttp(HttpClient, bool)
Uses client, whose BaseAddress must be the service's base URL.
Disposes it only when ownsClient is true.
public HttpClientRendezvousHttp(HttpClient client, bool ownsClient)
Parameters
clientHttpClientownsClientbool
Exceptions
- ArgumentNullException
clientis null.
HttpClientRendezvousHttp(Uri)
Talks to the service at baseUrl with a client of its own.
public HttpClientRendezvousHttp(Uri baseUrl)
Parameters
baseUrlUri
Exceptions
- ArgumentNullException
baseUrlis null.
Fields
DefaultTimeout
How long one request may take by default.
public static readonly TimeSpan DefaultTimeout
Field Value
Methods
Dispose()
Disposes the HttpClient if this object created it.
public void Dispose()
SendAsync(string, string, string, IReadOnlyDictionary<string, string>, CancellationToken)
Sends method path (relative to the service's base URL) with an
optional JSON body and extra headers, and returns the status and body. Throws only when no
response came back (the service is unreachable, or the request timed out).
public Task<RendezvousHttpResponse> SendAsync(string method, string path, string jsonBody, IReadOnlyDictionary<string, string> headers, CancellationToken cancellationToken)
Parameters
methodstringpathstringjsonBodystringheadersIReadOnlyDictionary<string, string>cancellationTokenCancellationToken
Returns
WithTrailingSlash(Uri)
baseUrl ending in a slash, so relative routes resolve under its path
(https://example.com/rendezvous + v1/register → https://example.com/rendezvous/v1/register).
public static Uri WithTrailingSlash(Uri baseUrl)
Parameters
baseUrlUri
Returns
Exceptions
- ArgumentNullException
baseUrlis null.