aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/components/GolfPlayApp.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/app/components/GolfPlayApp.tsx')
-rw-r--r--frontend/app/components/GolfPlayApp.tsx15
1 files changed, 10 insertions, 5 deletions
diff --git a/frontend/app/components/GolfPlayApp.tsx b/frontend/app/components/GolfPlayApp.tsx
index c6c20d4..3cb512a 100644
--- a/frontend/app/components/GolfPlayApp.tsx
+++ b/frontend/app/components/GolfPlayApp.tsx
@@ -15,12 +15,18 @@ type Problem = components["schemas"]["Problem"];
type GameState = "connecting" | "waiting" | "starting" | "gaming" | "finished";
-export default function GolfPlayApp({ game }: { game: Game }) {
- // const socketUrl = `wss://t.nil.ninja/iosdc/2024/sock/golf/${game.game_id}/play`;
+export default function GolfPlayApp({
+ game,
+ sockToken,
+}: {
+ game: Game;
+ sockToken: string;
+}) {
+ // const socketUrl = `wss://t.nil.ninja/iosdc/2024/sock/golf/${game.game_id}/play?token=${sockToken}`;
const socketUrl =
process.env.NODE_ENV === "development"
- ? `ws://localhost:8002/sock/golf/${game.game_id}/play`
- : `ws://api-server/sock/golf/${game.game_id}/play`;
+ ? `ws://localhost:8002/sock/golf/${game.game_id}/play?token=${sockToken}`
+ : `ws://api-server/sock/golf/${game.game_id}/play?token=${sockToken}`;
const { sendJsonMessage, lastJsonMessage, readyState } =
useWebSocket<WebSocketMessage>(socketUrl, {});
@@ -66,7 +72,6 @@ export default function GolfPlayApp({ game }: { game: Game }) {
}, [gameState, startedAt, game.duration_seconds]);
const [currentScore, setCurrentScore] = useState<number | null>(null);
- void setCurrentScore;
const onCodeChange = useDebouncedCallback((code: string) => {
console.log("player:c2s:code");