connection works

This commit is contained in:
2025-11-27 17:16:07 +05:30
parent 4565c4b33a
commit 4d6511505a
2 changed files with 144 additions and 71 deletions

View File

@@ -19,8 +19,8 @@ export default function TicTacToe() {
joinMatchmaker,
joinMatch,
onMatchData,
socket,
sendMatchData
onMatchmakerMatched,
sendMatchData,
} = useNakama();
// ------------------------------------------
@@ -42,15 +42,14 @@ export default function TicTacToe() {
}
});
// When matchmaker finds a match
socket!.onmatchmakermatched = async (matched) => {
onMatchmakerMatched(async (matched) => {
console.log("Matched:", matched);
const fullMatchId = matched.match_id;
setMatchId(fullMatchId);
await joinMatch(fullMatchId);
};
})
}
// ------------------------------------------
@@ -77,7 +76,7 @@ export default function TicTacToe() {
{!matchId && (
<>
<input
placeholder="username/device ID"
placeholder="username"
value={username}
onChange={(e) => setUsername(e.target.value)}
/>