What is a bridge?

How to use bridges and proxies

Paul Winterhalder avatar
Written by Paul Winterhalder
Updated over a week ago

As you probably already know, cloud code scripts are custom Javascript-based scripts that you write, and run on brainCloud's servers.

The Javascript runtime environment is based upon Mozilla Rhino, which is an open-source implementation of Javascript written in Java.

As such, the brainCloud Cloud Code environment is a very pure implementation of Javascript -- but it needs to be able to integrate with brainCloud's APIs! And that's where the bridge comes in.

The bridge is a software bridge between the cloud code environment and the rest of brainCloud's services and APIs.

Each of brainCloud's services are implemented via a separate interface class. To make an API call, you must first acquire access to a proxy object for that service, via... guess what?  the bridge!

Here is a quick example.

var playerStateService = bridge.getPlayerStateServiceProxy();
var numLogins = playerStateService.readPlayerState().data.loginCount;


For more information on writing cloud code scripts, see the Cloud Code section of our API Reference, and the Cloud Code Tutorials.

Your feedback is important to us. Please rate this response below. Thanks! 

Did this answer your question?