Vikja
The Vikja Module implements a shared key-value store used for attaching arbitrary properties to Entities. Each change to the store is broadcast to all participants. The current state of the store is sent to joining participants.
Vikja can also be used for persisted, indirect message-passing.
Basic usage
Import the Vikja module
using Auki.ConjureKit.Vikja;
Initialize the Vikja module
public class Demo : MonoBehaviour
{
public Transform cameraTransform;
private IConjureKit _conjureKit;
private Vikja _vikja;
private void Start()
{
var config = AukiConfiguration.Get();
_conjureKit = new ConjureKit(config, cameraTransform, "app_key", "app_secret");
_vikja = new Vikja(_conjureKit);
}
}
Attach callbacks
_vikja.OnEntityAction += (entityAction) =>
{
Debug.Log($"Received an entity action {entityAction}");
};
For more information about all available callbacks, please see the Class definition.
Request an action on an Entity
_vikja.RequestAction(
entityId,
"action_name", // this string will serve as a key to retrieve the action
new SomeArbitraryData().ToJsonByteArray(), // the payload can be an arbitrary byte array
entityAction => Debug.Log($"successFully sent {entityAction}."),
error => Debug.Log($"Received error {error} when trying to send action.")
);