Class ServiceEndpointsBuilder
Contains methods for configuring the SDK's service URIs.
Inherited Members
Namespace: LaunchDarkly.Sdk.Client.Integrations
Assembly: LaunchDarkly.ClientSdk.dll
Syntax
public class ServiceEndpointsBuilder
Remarks
If you want to set non-default values for any of these properties, create a builder with ServiceEndpoints(), change its properties with the methods of this class, and pass it to ServiceEndpoints(ServiceEndpointsBuilder).
The default behavior, if you do not change any of these properties, is that the SDK will connect to the standard endpoints in the LaunchDarkly production service. There are several use cases for changing these properties:
- You are using the LaunchDarkly Relay Proxy. In this case, set RelayProxy(Uri) to the base URI of the Relay Proxy instance. Note that this is not the same as a regular HTTP proxy, which would be set with Proxy(IWebProxy).
- You are connecting to a private instance of LaunchDarkly, rather than the standard production services. In this case, there will be custom base URIs for each service, so you must set Streaming(Uri), Polling(Uri), and Events(Uri).
- You are connecting to a test fixture that simulates the service endpoints. In this case, you may set the base URIs to whatever you want, although the SDK will still set the URI paths to the expected paths for LaunchDarkly services.
Each of the setter methods can be called with either a Uri or an equivalent string. Passing a string that is not a valid URI will cause an immediate UriFormatException
If you are using a private instance and you set some of the base URIs, but not all of them, the SDK will log an error and may not work properly. The only exception is if you have explicitly disabled the SDK's use of one of the services: for instance, if you have disabled analytics events with NoEvents, you do not have to set Events(Uri).
Examples
// Example of specifying a Relay Proxy instance
var config = Configuration.Builder(mobileKey)
.ServiceEndpoints(Components.ServiceEndpoints()
.RelayProxy("http://my-relay-hostname:8080"))
.Build();
// Example of specifying a private LaunchDarkly instance
var config = Configuration.Builder(mobileKey)
.ServiceEndpoints(Components.ServiceEndpoints()
.Streaming("https://stream.mycompany.launchdarkly.com")
.Polling("https://app.mycompany.launchdarkly.com")
.Events("https://events.mycompany.launchdarkly.com"))
.Build();
Methods
| Edit this page View SourceBuild()
Called internally by the SDK to create a configuration instance. Applications do not need to call this method.
Declaration
public ServiceEndpoints Build()
Returns
Type | Description |
---|---|
ServiceEndpoints | the configuration object |
Events(string)
Equivalent to Events(Uri), specifying the URI as a string.
Declaration
public ServiceEndpointsBuilder Events(string eventsBaseUri)
Parameters
Type | Name | Description |
---|---|---|
string | eventsBaseUri | the base URI of the events service, or null to reset to the default |
Returns
Type | Description |
---|---|
ServiceEndpointsBuilder | the same builder |
Exceptions
Type | Condition |
---|---|
UriFormatException | if the string is not null and is not a valid URI |
See Also
| Edit this page View SourceEvents(Uri)
Sets a custom base URI for the events service.
Declaration
public ServiceEndpointsBuilder Events(Uri eventsBaseUri)
Parameters
Type | Name | Description |
---|---|---|
Uri | eventsBaseUri | the base URI of the events service; null to use the default |
Returns
Type | Description |
---|---|
ServiceEndpointsBuilder | the builder |
Remarks
You should only call this method if you are using a private instance or a test fixture (see ServiceEndpointsBuilder). If you are using the LaunchDarkly Relay Proxy, call RelayProxy(Uri) instead.
Examples
var config = Configuration.Builder(mobileKey) .ServiceEndpoints(Components.ServiceEndpoints() .Streaming("https://stream.mycompany.launchdarkly.com") .Polling("https://app.mycompany.launchdarkly.com") .Events("https://events.mycompany.launchdarkly.com")) .Build();
See Also
| Edit this page View SourcePolling(string)
Equivalent to Polling(Uri), specifying the URI as a string.
Declaration
public ServiceEndpointsBuilder Polling(string pollingBaseUri)
Parameters
Type | Name | Description |
---|---|---|
string | pollingBaseUri | the base URI of the polling service, or null to reset to the default |
Returns
Type | Description |
---|---|
ServiceEndpointsBuilder | the same builder |
Exceptions
Type | Condition |
---|---|
UriFormatException | if the string is not null and is not a valid URI |
See Also
| Edit this page View SourcePolling(Uri)
Sets a custom base URI for the polling service.
Declaration
public ServiceEndpointsBuilder Polling(Uri pollingBaseUri)
Parameters
Type | Name | Description |
---|---|---|
Uri | pollingBaseUri | the base URI of the polling service; null to use the default |
Returns
Type | Description |
---|---|
ServiceEndpointsBuilder | the builder |
Remarks
You should only call this method if you are using a private instance or a test fixture (see ServiceEndpointsBuilder). If you are using the LaunchDarkly Relay Proxy, call RelayProxy(Uri) instead.
Examples
var config = Configuration.Builder(mobileKey) .ServiceEndpoints(Components.ServiceEndpoints() .Streaming("https://stream.mycompany.launchdarkly.com") .Polling("https://app.mycompany.launchdarkly.com") .Events("https://events.mycompany.launchdarkly.com")) .Build();
See Also
| Edit this page View SourceRelayProxy(string)
Equivalent to RelayProxy(Uri), specifying the URI as a string.
Declaration
public ServiceEndpointsBuilder RelayProxy(string relayProxyBaseUri)
Parameters
Type | Name | Description |
---|---|---|
string | relayProxyBaseUri | the Relay Proxy base URI, or null to reset to default endpoints |
Returns
Type | Description |
---|---|
ServiceEndpointsBuilder | the same builder |
Exceptions
Type | Condition |
---|---|
UriFormatException | if the string is not null and is not a valid URI |
See Also
| Edit this page View SourceRelayProxy(Uri)
Specifies a single base URI for a Relay Proxy instance.
Declaration
public ServiceEndpointsBuilder RelayProxy(Uri relayProxyBaseUri)
Parameters
Type | Name | Description |
---|---|---|
Uri | relayProxyBaseUri | the Relay Proxy base URI, or null to reset to default endpoints |
Returns
Type | Description |
---|---|
ServiceEndpointsBuilder | the builder |
Remarks
When using the LaunchDarkly Relay Proxy, the SDK only needs to know the single base URI of the Relay Proxy, which will provide all of the proxied service endpoints.
Note that this is not the same as a regular HTTP proxy, which would be set with Proxy(IWebProxy).
Examples
var relayUri = new Uri("http://my-relay-hostname:8080");
var config = Configuration.Builder(mobileKey)
.ServiceEndpoints(Components.ServiceEndpoints().RelayProxy(relayUri))
.Build();
See Also
| Edit this page View SourceStreaming(string)
Equivalent to Streaming(Uri), specifying the URI as a string.
Declaration
public ServiceEndpointsBuilder Streaming(string streamingBaseUri)
Parameters
Type | Name | Description |
---|---|---|
string | streamingBaseUri | the base URI of the streaming service, or null to reset to the default |
Returns
Type | Description |
---|---|
ServiceEndpointsBuilder | the same builder |
Exceptions
Type | Condition |
---|---|
UriFormatException | if the string is not null and is not a valid URI |
See Also
| Edit this page View SourceStreaming(Uri)
Sets a custom base URI for the streaming service.
Declaration
public ServiceEndpointsBuilder Streaming(Uri streamingBaseUri)
Parameters
Type | Name | Description |
---|---|---|
Uri | streamingBaseUri | the base URI of the streaming service; null to use the default |
Returns
Type | Description |
---|---|
ServiceEndpointsBuilder | the builder |
Remarks
You should only call this method if you are using a private instance or a test fixture (see ServiceEndpointsBuilder). If you are using the LaunchDarkly Relay Proxy, call RelayProxy(Uri) instead.
If you set a custom Streaming
URI, you must also set a custom Polling
URI.
Even when in streaming mode, the SDK may sometimes need to make a request to the polling
service.
Examples
var config = Configuration.Builder(mobileKey) .ServiceEndpoints(Components.ServiceEndpoints() .Streaming("https://stream.mycompany.launchdarkly.com") .Polling("https://app.mycompany.launchdarkly.com") .Events("https://events.mycompany.launchdarkly.com")) .Build();