Exemple #1
0
        /// <summary>
        /// Posts an empty JSON blob to the given uri
        /// </summary>
        /// <param name="uri">The URI to HTTP POST an empty blob</param>
        private static void EmptyPost(string uri)
        {
            UnityWebRequest request = UnityWebRequest.Post(uri, AgonesSdkClient.emptyPayload);

            request.uploadHandler = new UploadHandlerRaw(AgonesSdkClient.emptyPayloadBytes);
            AgonesSdkClient.ConfigureRequest(request);
            request.SendWebRequest();
        }
Exemple #2
0
        /// <summary>
        /// Makes a call to set a key/value pair
        /// </summary>
        /// <param name="key">The key name</param>
        /// <param name="value">The value</param>
        /// <param name="uri">The URI to post the key/value pair</param>
        private void SetProperty(string key, string value, string uri)
        {
            KeyValueMessage msg = new KeyValueMessage()
            {
                key   = key,
                value = value
            };

            string payload = JsonConvert.SerializeObject(msg);

            UnityWebRequest request = UnityWebRequest.Put(uri, payload);

            request.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(payload));
            AgonesSdkClient.ConfigureRequest(request);
            request.SendWebRequest();
        }
Exemple #3
0
 /// <summary>
 /// This tells Agones to shut down the currently running game server. The GameServer
 /// state will be set Shutdown and the backing Pod will be deleted, if they have not
 /// shut themselves down already.
 /// </summary>
 public void Shutdown()
 {
     AgonesSdkClient.EmptyPost("http://localhost:59358/shutdown");
 }
Exemple #4
0
 /// <summary>
 /// This sends a single ping to designate that the Game Server is alive and healthy.
 /// Failure to send pings within the configured thresholds will result in the GameServer
 /// being marked as Unhealthy.
 /// </summary>
 public void Health()
 {
     AgonesSdkClient.EmptyPost("http://localhost:59358/health");
 }
Exemple #5
0
 /// <summary>
 /// This tells Agones that the Game Server is ready to take player connections.
 /// Once a Game Server has specified that it is Ready, then the Kubernetes GameServer
 /// record will be moved to the Ready state, and the details for its public address
 /// and connection port will be populated.
 /// </summary>
 public void Ready()
 {
     AgonesSdkClient.EmptyPost("http://localhost:59358/ready");
 }