matchmaking support multigame
This commit is contained in:
@ -21,13 +21,12 @@ class MatchMaking
|
||||
* @param {Number} mode The number of players in a game
|
||||
* @returns {Promise<?>}
|
||||
*/
|
||||
async start(receive_func, disconnect_func, mode, gamemode)
|
||||
async start(receive_func, disconnect_func, gamemode, mode)
|
||||
{
|
||||
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}`;
|
||||
let url = `${window.location.protocol[4] === 's' ? 'wss' : 'ws'}://${window.location.host}/ws/matchmaking/${gamemode}/${mode}`;
|
||||
|
||||
this._socket = new WebSocket(url);
|
||||
|
||||
@ -50,10 +49,7 @@ class MatchMaking
|
||||
this.disconnect_func(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<?>}
|
||||
*/
|
||||
async stop()
|
||||
stop()
|
||||
{
|
||||
if (this._socket)
|
||||
this._socket.close();
|
||||
|
Reference in New Issue
Block a user