Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: namespace configs for transmitters and options #273

Merged
merged 11 commits into from
May 19, 2024

Conversation

lukeocodes
Copy link
Contributor

@lukeocodes lukeocodes commented Apr 29, 2024

Full compatible with existing config (through a legacy config transformer)

The client options will look like this for custom headers for Fetch and WS Node clients;

{
  global: {
    fetch: { options: { headers: { "customheader": "value" } } },
    websocket: { options: { _nodeOnlyHeaders: { "customheader": "value" } } }
  }
  // ... other namespaces
} 

Namespace configurations are coming, too.

You'll now be able to provide config to specific namespaces in the SDK.

{
  global: {
    fetch: { options: { headers: { "customheader": "value" } } },
  },
  listen: {
    fetch: { options: { 
      url: "http://localhost:3000"
    } },
  }
  // ... other namespaces
} 

Finally, for the holy grail of overriding a client, which will also be available in namespace config, and will have access to the namespaceOptions scope.

{
  listen: {
    client: async (options) => {} // their client here
  }
} 

@lukeocodes lukeocodes self-assigned this Apr 30, 2024
@lukeocodes lukeocodes added the enhancement New feature or request label Apr 30, 2024
@lukeocodes lukeocodes marked this pull request as ready for review April 30, 2024 22:54
@lukeocodes lukeocodes mentioned this pull request May 2, 2024
@dennisofficial
Copy link

Oooooo. Elaborate the namespace? You mean we can abstract the client classes? Like 'PrerecordedClient' class?

@lukeocodes
Copy link
Contributor Author

lukeocodes commented May 6, 2024 via email

@dennisofficial
Copy link

Does this allow us to set a fetch timeout or abort signal? That would be so helpful ❤️

@dennisofficial
Copy link

The only reason I would override the class is to include an abort signal code so I can attach the signal property to the fetch request.

@lukeocodes
Copy link
Contributor Author

The only reason I would override the class is to include an abort signal code so I can attach the signal property to the fetch request.

Depends on the environment. As far as I know, you cannot provide Fetch a custom timeout, but you'll be able to create your own fetch wrapper than maybe even uses http/https instead, and bridges the compability layer.

You'll definitely be able to provide it a signal controller though.

@lukeocodes lukeocodes changed the base branch from main to release/namespaces-and-transmittion May 15, 2024 11:32
@lukeocodes lukeocodes merged commit 957dbb1 into release/namespaces-and-transmittion May 19, 2024
@lukeocodes lukeocodes deleted the lo/namespace-configs branch May 19, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants