Provide BeamContext (optional)

Client Authoritative

In the majority of scenarios, the Default Context serves the purpose. However, in cases such as when you're developing a game that supports local multiplayer, you can have multiple Beamable Contexts (one for each player). This Context is essential for transmitting messages to the Beamable Microservice. Consequently, if you don't explicitly provide a Context, the system defaults to the Default Context, making it an 'optional' setting."

The Beamable Provider must have access to the BeamContext in order to invoke the correct instance of the Microservice. By default, the Default BeamContext is used, but there is also the option to provide the Beamable Provider with a BeamContext yourself. This ensures that the correct context is used.

📘

Again, this is optional, internally the Default BeamContext will be used if the BeamContext is not set explicitly. Also, this step should only be performed once (in most cases), during initialisation or whenever the BeamContext changes.

Setting the BeamContext can be achieved very easily with the following piece of code:

//...wherever you initialize or change the context
var ctx = BeamContext.Default
await ctx.OnReady;

//Provide BeamContext to Beamable Provider
VenlyAPI.SetProviderData(VyProvider_Beamable.BeamContextDataKey, ctx);

👍

All Venly's client authoritative (or custom-allowed) functions can now be called from the client! 🎉