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

Use URL library to allow custom query parameters when connecting to client #91

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jarrilla
Copy link

@jarrilla jarrilla commented Dec 26, 2024

✅ All tests passed.

Current behavior hardcodes query URL formation, which prevents users from adding their own parameters.

Using URL library to parse incoming req.url will behave the same (still add model parameter ?model=gpt-4o....), but allow users to define extra parameters when connecting.

E.g. (using Vite)

const baseUrl = `${import.meta.env.VITE_API_BASE_URL}/stream`;
const url = new URL(baseUrl);
url.searchParams.append('sessionId', props.sessionId);

const client = new RealtimeClient({
  url: url.toString(),
  // url: "localhost:3000/stream?sessionId=1234" // this would also work
});

@jarrilla jarrilla changed the title use URL lib to form url with query Use URL library to allow custom query parameters when connecting to client Dec 26, 2024
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.

1 participant