Repository navigation
Conversation
These pages built the URL from SERVER_BASE_URL, which is not exposed to the browser, so they always targeted localhost:8001 (and kept the http scheme). Reuse getWebSocketUrl() like chat and codemap, so they follow the page host, NEXT_PUBLIC_API_PORT and NEXT_PUBLIC_WS_BASE_URL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The slides and workshop pages open their WebSocket with:
SERVER_BASE_URLis not aNEXT_PUBLIC_variable, so in the browser this is alwayshttp://localhost:8001, and the ternary is always truthy, so anhttpbase never becomesws. On any deployment not opened from localhost these pages try the viewer's own machine, wait for the timeout and only then fall back to/api/chat/stream. Behind a reverse proxy they also ignoreNEXT_PUBLIC_WS_BASE_URL.Chat and codemap already solved this in
src/utils/websocketClient.ts. This exportsgetWebSocketUrl()from there and uses it in both pages, so all WebSocket callers resolve the URL the same way (page host +NEXT_PUBLIC_API_PORT, orNEXT_PUBLIC_WS_BASE_URL).Refs #389
Tested:
tsc --noEmitpasses.node -ewith the old expression giveshttp://localhost:8001/ws/chatfor the default value.