const urlParams = new URLSearchParams(window.location.search); const gameId = urlParams.get('game_id'); const userId = localStorage.getItem('userId'); const socket = io('/batalla', { closeOnBeforeunload: true, auth: { userId, gameId } });