add: Morpion class & matchmaking

This commit is contained in:
Namonay
2024-03-22 16:28:49 +01:00
committed by AdrienLSH
parent 0a61c8ecd9
commit 9a24c3b813
2 changed files with 76 additions and 1 deletions

View File

@ -21,11 +21,12 @@ class MatchMaking
* @param {Number} mode The number of players in a game
* @returns {Promise<?>}
*/
async start(receive_func, disconnect_func, mode)
async start(receive_func, disconnect_func, mode, gamemode)
{
if (!await this.client.isAuthenticated())
return null;
this.gamemode = gamemode
let url = `${window.location.protocol[4] === 's' ? 'wss' : 'ws'}://${window.location.host}/ws/matchmaking/${mode}`;
this._socket = new WebSocket(url);