🔨(frontend) add room to ws signaling url

Add the room to the ws signaling url so that
the ingress controller can route the request
to the correct pod.
This commit is contained in:
Anthony LC
2024-05-28 22:41:50 +02:00
committed by Anthony LC
parent b47e60d6ec
commit 3d594a99d5
3 changed files with 10 additions and 5 deletions

View File

@@ -33,7 +33,7 @@ test.describe('Pad Editor', () => {
await expect(page.locator('h2').getByText(randomPad[0])).toBeVisible();
const webSocket = await webSocketPromise;
expect(webSocket.url()).toBe('ws://localhost:4444/');
expect(webSocket.url()).toContain('ws://localhost:4444/');
const framesentPromise = webSocket.waitForEvent('framesent');

View File

@@ -6,6 +6,10 @@ export const baseApiUrl = () => {
return `${origin}${process.env.NEXT_PUBLIC_API_URL}`;
};
export const signalingUrl = () =>
process.env.NEXT_PUBLIC_SIGNALING_URL ||
(typeof window !== 'undefined' ? `wss://${window.location.host}/ws` : '');
export const signalingUrl = (padId: string) => {
const base =
process.env.NEXT_PUBLIC_SIGNALING_URL ||
(typeof window !== 'undefined' ? `wss://${window.location.host}/ws` : '');
return `${base}/${padId}`;
};

View File

@@ -31,7 +31,8 @@ export const usePadStore = create<PadStore>((set) => ({
}
const provider = new WebrtcProvider(padId, doc, {
signaling: [signalingUrl()],
signaling: [signalingUrl(padId)],
maxConns: 5,
});
set(({ padsStore }) => {