...
It is possible and useful to have multiple space connections running simultaneously within a single session. This is achieved using Tags, which are user-defined identifiers for a CavrnusSpaceConnection.
...
By utilizing multiple JoinSpaceWithOptions() along with corresponding AwaitSpaceConnectionByTag() calls, multiple space connections will be created and independently handled allowing for multiple spaces to coexist simultaneously.
Code Block | ||
---|---|---|
| ||
public void Start() { CavrnusFunctionLibrary.AwaitAuthentication(auth => { var configA = new CavrnusSpaceConnectionConfig {Tag = "A"}; CavrnusFunctionLibrary.JoinSpaceWithOptions("Space-A", configA, print, print); var configB = new CavrnusSpaceConnectionConfig {Tag = "B"}; CavrnusFunctionLibrary.JoinSpaceWithOptions("Space-B", configB, print, print); }); CavrnusFunctionLibrary.AwaitSpaceConnectionByTag("A", spaceConnection => { print("Space A is now connected!"); }); CavrnusFunctionLibrary.AwaitSpaceConnectionByTag("B", spaceConnection => { print("Space B is now connected!"); }); } } |