-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default to the same host when determing WebSocket URL
We still need to be able to override it in order to use the Sveltekit dev server
- Loading branch information
Showing
3 changed files
with
11 additions
and
7 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const determineWebSocketUrl = () => { | ||
const urlParams = new URLSearchParams(window.location.search) | ||
|
||
// Use whatever is specified by the "ws" query parameter, default | ||
// to the current host of nothing is specified. This allows us to | ||
// manually define the WebSocket host when running the Svelte | ||
// development server. | ||
return urlParams.get('ws') || `ws://${window.location.host}` | ||
} |
This file contains 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