Affected: All SDKs
Overview
Some customers and end-users in Pakistan have experienced difficulty maintaining a persistent connection to LaunchDarkly.
While LaunchDarkly is a product with global reach, inconsistencies between the internet services of different countries can make it difficult to predict where we might have outages. Some customers have reported difficulty maintaining a connection to LaunchDarkly from Pakistan.
We offer these customers the following alternatives to a conventional LaunchDarkly process.
Solution
Configure your SDKs to either use the Relay Proxy (deployed in a cloud region geographically close to Pakistan, such as AWS Mumbai or Azure UAE, to improve connectivity and reduce latency), or bootstrap flags (for Client-side JavaScript-based SDKs only).
For more information about the Relay Proxy, read: Relay Proxy
Client-side SDKs
Below is an example of how to bootstrap flags from local storage for the JavaScript SDK.
const options = { bootstrap: 'localStorage' }
const client = LDClient.initialize('client-side-id-123abc', context, options);
try {
await client.waitForInitialization(5);
proceedWithSuccessfullyInitializedClient();
} catch(err) {
// Client failed to initialized or timed out
// variation() calls return fallback values until initialization completes
}For more information about bootstrapping, read: Bootstrapping
Below is an example of how to connect the SDK to the Relay Proxy for the JavaScript SDK.
const options = {
streamUrl: 'https://your-relay-proxy.com:8030',
baseUrl: 'https://your-relay-proxy.com:8030',
eventsUrl: 'https://your-relay-proxy.com:8030'
};Mobile SDKs
Below is an example of how to connect the SDK to the Relay Proxy for the iOS SDK in Swift.
var ldConfig = LDConfig(mobileKey: "mobile-key-123abc", autoEnvAttributes: .enabled) ldConfig.streamUrl = URL(string: "https://your-relay-proxy.com:8030") ldConfig.baseUrl = URL(string: "https://your-relay-proxy.com:8030") ldConfig.eventsUrl = URL(string: "https://your-relay-proxy.com:8030")
For more information about connecting Client-side SDKs to the Relay Proxy, read: Client-side SDKs
Server-side SDKs
Below is an example of how to connect the SDK to the Relay Proxy for the Node.js Server-side SDK in Typescript.
import * as ld from '@launchdarkly/node-server-sdk';
const options ld.LDOptions = {
streamUri: 'https://your-relay-proxy.com:8030',
baseUri: 'https://your-relay-proxy.com:8030',
eventsUri: 'https://your-relay-proxy.com:8030',
};For more information about connecting Server-side SDKs to the Relay Proxy, read: Server-side SDKs