Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Enable initializing multiple clients #10

@IsaacDurand

Description

@IsaacDurand

Is your feature request related to a problem? Please describe.
Yes. I'm working on an app that allows the user to toggle between multiple environments (staging, production, etc.). Each environment corresponds to a different database and a different LaunchDarkly environment with different targeting rules.

The problem I'm having is that the user gets "stuck" with the feature flag values for the first environment they select. For example, if the user chooses "production", the app initializes a LaunchDarkly client with the mobileKey for production. That way, the client provides the appropriate feature flag values for the production environment. However, if the user then toggles to the "staging" environment, the client still provides the feature flag values for production.

I attempted to create a different client for each environment, but when I tried to initialize a second client, I got an error: "Client was already initialized".

Describe the solution you'd like
I'd like to be able to create multiple client instances, just as I can with the Node SDK.

Describe alternatives you've considered
I can think of a couple alternate approaches:

  1. Allow the SDK user to destroy the existing client instance and create a new one to replace it
  2. Allow the SDK user to update the client configuration options (including mobileKey) for a client that's already been initialized

Either of these solutions would work for me as well. I'm not sure which of the three options is easiest to implement.

Additional context
I'm really enjoying working with this SDK - thanks so much for making it available!

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions