Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_WEBSOCKET_URL=
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
- `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash`
- `nvm install 22 && nvm use 22`

# Running locally

- Run `cp .env.example .env.local`
- Run `npm run dev`

## Build

- Run `npm ci`
Expand Down
8 changes: 7 additions & 1 deletion src/api/ws/ConnectionProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ import {
messageEventType,
} from "./ConnectionContext";

const VITE_WEBSOCKET_URL = (
import.meta.env.VITE_WEBSOCKET_URL as string
).trim();

export function ConnectionProvider({ children }: PropsWithChildren) {
const [ctxValue, _setCtxValue] = useState(defaultCtxValue);
// connect to current host via websocket
const websocketUrl = `${window.location.protocol.startsWith("https") ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}/websocket`;
const websocketUrl = VITE_WEBSOCKET_URL
? VITE_WEBSOCKET_URL
: `${window.location.protocol.startsWith("https") ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}/websocket`;

const setSocketState = useSetAtom(socketStateAtom);

Expand Down