brainCloud is very feature-rich, but it is impossible for a backend to provide every possible features.

Luckily, brainCloud makes it easy to integrate your app with custom and 3rd party services. (And this is over-and-above the integrations built into brainCloud!)

Integration with custom servers/services is controlled by two screens in the Cloud Code section of the portal:

  • Web Services - here you define external services that you would like your cloud code scripts to be able to talk to. You simply declare the http address of the external service, give it a service code (i.e. name), and then make calls via the HttpClient API 
  • My Servers - this is where you declare servers that should have privileged access to your app (via the S2S API). This may be for custom tools and services you have written, or for special Room and Relay Servers that brainCloud can host (and launch) for your app.

The following server types can be configured via the My Servers page:

  • Custom Server - these are simply external servers that you want to be able to access your app via the S2S API. For additional security, it is recommended that you declare the ip ranges of these servers, so that brainCloud can automatically block unwanted requests.
  • Relay Server - relay servers are a simple form of multiplayer server without business or game logic. When a user sends a message to a relay server, the server will relay that message out to all the other users in the session. Relay Servers are very useful for casual realtime multiplayer games. brainCloud V4 introduced relay servers and our relay communications protocol. Creating a Relay Server configuration for your app allows brainCloud to automatically launch Relay Servers from Lobbies. 
  • Room Server - unlike relay servers, room servers contain custom game or business logic for your multiplayer experience. To configure a Room Server, you must configure brainCloud with the details of a Docker image to load when spinning up the servers. Room Servers, like Relay Servers, can be automatically launched from Lobbies.
  • Room Server Manager - this option allows you to specify the URL for a service that will act as a Room Server Manager for brainCloud Lobbies. This allows you to custom control the hosting/allocation of your own Room Servers separate from brainCloud.

When configuring Relay Servers and Room Servers, there are some special parameters to keep in mind:

  • Server Size - the size of server to be allocated in the cloud provider. Specs on the available sizes can be found here.
  • Containers Per Server - indicates the # of docker instances to spin up on the server. The # to configure here depends upon the size of the server you're chosen, the # of users your experience supports, and the complexity of the server experience. The higher the number, the lower the # of physical servers necessary to service your app (and the lower your costs)
  • Min Ready Containers - indicates who many container slots should be available at all times. For example, if you have configured your servers to support 3 container slots, with minReady=1, and all 3 are currently in use, brainCloud will automatically spin up an additional server so that you have at least minReady>=1.  If minReady were set to 0, brainCloud wouldn't proactively spin up the extra server. Will lead to quicker startup of Relay/Room server sessions - but it will also lead to higher costs for your app.
  • Max Servers - sets the maximum # of servers to spin up (per region). This is used to help control hosting costs.
  • Keep Idle Servers Warm - this specifies a number of minutes to keep unused servers around before shutting them down. Higher numbers will give quicker startup of Relay/Room server sessions - but will also lead to higher costs for your app.
  • Max Session Time - this is a watchdog timeout used to ensure that your experience doesn't get hung, leading to a server that can never be deallocated (and adds to your costs). If the max session time is hit, brainCloud will kill the container service.
  • Custom Environment - use this JSON section to specify environment variables to configure for your service.

Room Servers include these additional parameters:

  • Docker Registry - the registry to retrieve your docker image from. Currently only dockerhub is supported.
  • Docker Repo - the address of your docker image
  • Exposed Ports - the ports that your image needs exposed, in the format: "80/tcp,888/udp"

And finally, all server types support:

  • Secret - the secret is used when the server communicates back to brainCloud. Each server type has it's own unique secret.
Did this answer your question?