Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
brainCloud Forums
  1. Home
  2. APIs
  3. Timeouts?

Timeouts?

Scheduled Pinned Locked Moved Solved APIs
unitytimeout
4 Posts 3 Posters 2.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    Ulrika Hjälmgården
    wrote on last edited by
    #1

    Hello!
    I work on a game made with Unity, and I have a general question about server requests and lost connections. If I make a call such as:

    _bc.EntityService.GetEntitiesByType(entityType,
                    (string response, object cbObject) =>
                    {
                        Debug.Log("SUCCESS");
                    },
                    (int statusCode, int reasonCode, string statusMessage, object cbObject) =>
                    {
                        Debug.Log("FAIL");
                    });
    

    What happens if the user lost connection before getting a response back? Do I get the fail callback? If so, after how long?

    1 Reply Last reply
    0
    • JonathanJ Offline
      JonathanJ Offline
      Jonathan
      wrote on last edited by
      #2

      If the app makes a call to brainCloud that timeouts, it will generate a CLIENT_NETWORK_ERROR_TIMEOUT (90001) error in the failure callback.

      _bc.EntityService.GetEntitiesByType(entityType,
          (string response, object cbObject) =>
          {
            Debug.Log("SUCCESS");
          },
          (int statusCode, int reasonCode, string statusMessage, object cbObject) =>
          {
            switch (reasonCode)
            {
      
              case ReasonCodes.CLIENT_NETWORK_ERROR_TIMEOUT:
                {
                  // Handle the timeout 
                  break;
                }
            }
          });
      
      

      The brainCloud SDK will timeout after a set interval. Currently, in the 4.2 release, the default is 35 seconds, but this may be adjusted later.

      You can also call SetPacketTimeouts to set a custom amount for your timeout values. But the defaults are recommended.

      An example of handling a timeout error in Unity can be found in our AuthenticationErrorHandling example.

      1 Reply Last reply
      0
      • Paul WinterhalderP Offline
        Paul WinterhalderP Offline
        Paul Winterhalder
        brainCloudAdmin
        wrote on last edited by
        #3

        Hi,

        A bit of a clarification.

        Internally, the brainCloud client is automatically retrying for you.

        The timeout setting is an array - the defaults are [15, 10, 10]. This means the first timeout is 15 seconds, then 10 seconds later, and 10 seconds after that. Totally 35 seconds.

        If after those 3 retries the app was unable to get a valid response, it finally sends a retry to the client.

        So, a couple of things:

        • 1 - don't change the defaults to make them smaller. That just hits our server harder.
        • 2 - Don't blindly retry calling brainCloud if the request times out. That's already been done 3 times! Could be their having mobile networking issues. Instead - pop up a retry dialog to your client.

        PS - We are considering extending this timeout a bit - because its possible to have scripts that only timeout after 60 seconds - and they aren't automatically handled without adjusting the client timeouts.

        The new values we are considering are 15, 20, 35, 50 - so the full timeout becomes 2 minutes, with excalating retries.

        Hope that helps!

        Paul.

        1 Reply Last reply
        0
        • U Offline
          U Offline
          Ulrika Hjälmgården
          wrote on last edited by
          #4

          Thanks guys! I figured it would be ridiculous if I had to do timeout checks and retries myself 🙂

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Solved
          • Unsolved
          • Users