// Sends a new matchmaking request ticket to the backend API public MatchMakingRequestInfo RequestMatchMaking(Dictionary <string, double> regionLatencies) { try { // Do the signed request and wait for max 10 seconds to complete string latenciesString = ""; int i = 0; foreach (var latency in regionLatencies) { // Using _ as the delimiter so that it works with the query string signing correctly latenciesString += latency.Key + "_" + Convert.ToInt32(latency.Value); if (i != regionLatencies.Count - 1) { latenciesString += "_"; } i++; } Debug.Log("Latencies: " + latenciesString); var response = Task.Run(() => this.SendSignedGetRequest(this.client.apiEndpoint + "requestmatchmaking?latencies=" + latenciesString)); response.Wait(10000); string jsonResponse = response.Result; MatchMakingRequestInfo info = JsonUtility.FromJson <MatchMakingRequestInfo>(jsonResponse); return(info); } catch (Exception e) { Debug.Log(e.Message); return(null); } }
// Sends a new matchmaking request ticket to the backend API public MatchMakingRequestInfo RequestMatchMaking() { try { // Do the signed request and wait for max 10 seconds to complete var response = Task.Run(() => this.SendSignedGetRequest(apiEndpoint + "requestmatchmaking")); response.Wait(10000); string jsonResponse = response.Result; MatchMakingRequestInfo info = JsonUtility.FromJson <MatchMakingRequestInfo>(jsonResponse); return(info); } catch (Exception e) { Debug.Log(e.Message); return(null); } }