Skip to content

Commit 13a065a

Browse files
committed
front edited
1 parent 362d5f1 commit 13a065a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

frontend/src/components/clock/ClockGrid.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ function ClockGrid(props) {
4646
return;
4747
}
4848

49-
const socket = new WebSocket("ws://localhost:8080/clock/coordinates");
49+
const backendUrl = process.env.REACT_APP_API_BASE || window.location.origin;
50+
const wsProtocol = backendUrl.startsWith("https") ? "wss" : "ws";
51+
const socket = new WebSocket(`${wsProtocol}://${new URL(backendUrl).host}/clock/coordinates`);
5052

5153
socket.onopen = () => {
5254
socket.send(JSON.stringify({

0 commit comments

Comments
 (0)