reconexio
This commit is contained in:
@@ -115,8 +115,12 @@ onMounted(async () => {
|
||||
const room = await colyseusService.joinLobby();
|
||||
colorInput.value = colyseusService.playerColor.value || '#667eea';
|
||||
|
||||
let resumed = false;
|
||||
const guardResume = () => { if (resumed) return true; resumed = true; return false; };
|
||||
|
||||
// Prefer reconnection token path to bypass locked rooms
|
||||
room.onMessage("resumeReconnection", async (data: any) => {
|
||||
if (guardResume()) return;
|
||||
try {
|
||||
await colyseusService.reconnectWithToken(data.token);
|
||||
// Leave lobby before navigating
|
||||
@@ -132,6 +136,7 @@ onMounted(async () => {
|
||||
|
||||
// Listen for server-initiated resume to existing game (fallback joinById)
|
||||
room.onMessage("resumeGame", async (data: any) => {
|
||||
if (guardResume()) return;
|
||||
try {
|
||||
const gameRoom = await colyseusService.joinGameRoom(data.roomId);
|
||||
// Leave lobby before navigating
|
||||
|
||||
Reference in New Issue
Block a user