Skip to content

Conversation

@bryfox
Copy link

@bryfox bryfox commented Oct 20, 2025

This adds a timeout parameter as part of a new options argument to each Server API client.

The RPC client constructor is modified to accept this timeout option, and applies it to all requests if supplied. This interface changes in a breaking way, but TwirpRPC isn't exported from the module.

The timeout value is expected to be seconds, which matches the existing timeouts in the RoomServiceClient. There's no up-front validation of the input values; an invalid value will result in an error thrown by node.js when used.

Resolves #548.

@changeset-bot
Copy link

changeset-bot bot commented Oct 20, 2025

⚠️ No Changeset found

Latest commit: 769f01d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@lukasIO lukasIO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, just two minor things

* @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY
* @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET
* @param options - client options
* @param options.requestTimeout - optional timeout, in seconds, for all server requests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of describing the usage here, could you do it just above the field definition in the ClientOptions type?

Would also be nice if we could share the ClientOptions type across different implementations instead of redefining it in each client module.

type Options = {
/** Prefix for the RPC requests */
prefix?: string;
/** Timeout for fetch requests, in seconds. Must resolve to a positive integer millisecond value. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "must resolve to a positive integer millisecond value" part feels slightly confusing to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose timeout option on Server SDK clients?

2 participants