🎮 Tic Tac Toe Multiplayer API
Base Socket.IO URL:
https://olddell.wampus-enigmatic.ts.net/szabfuntic-tac-toe/socket.io
This API uses Socket.IO for real-time multiplayer Tic-Tac-Toe games.
Connect
Connect to the Socket.IO server using the custom path:
const socket = io("https://olddell.wampus-enigmatic.ts.net/szabfun", { path: "/tic-tac-toe/socket.io" });
Socket.IO Events
-
startGame
Sent by server when a game starts.{ room: "room-id", symbol: "X" | "O" } -
waitingForOpponent
Sent by server if you are waiting for another player.{ room: "room-id" } -
roomFull
Sent by server if the room is full.{ room: "room-id" } -
updateBoard
Sent by server when the opponent makes a move.[["X", "", ""], ["", "O", ""], ["", "", ""]] -
gameOver
Sent by server when the game ends.{ winner: "X" | "O" | null } -
playAgainRequested
Sent by server when the opponent requests a rematch.{ count: 1 | 2 }
Client Events
-
joinRoom
Join a specific room (optional, for custom games):socket.emit("joinRoom", "room-id"); -
move
Send your move to the server:socket.emit("move", { room: "room-id", board: [["X", "", ""], ["", "O", ""], ["", "", ""]] }); -
gameOver
Notify server that the game is over:socket.emit("gameOver", { room: "room-id", winner: "X" }); -
playAgain
Request a rematch:socket.emit("playAgain", { room: "room-id" });
Game Flow
- Connect to the server via Socket.IO.
- Wait for
startGameevent to receive your symbol and room. - Send moves using the
moveevent. - Listen for
updateBoardandgameOverevents.