FCavrnusSpaceConnection (Unreal Engine)

Represents a user’s live connection to a specific Cavrnus Space.

Navigation

Cavrnus C++ API Reference > Cavrnus Types

References

Module

CavrnusSpatialConnector

Header

<Project>/Plugins/CavrnusConnector/Source/CavrnusConnector/Public/Types/CavrnusSpaceConnection.h

Include

#include "Types/CavrnusSpaceConnection.h"

Syntax

struct FCavrnusSpaceConnection(int SpaceConnectionId) : SpaceConnectionId(SpaceConnectionId)

Variables

 

Type

Name

Description

 

Type

Name

Description

 

int

SpaceConnectionId

Unique identifier for the space connection

 

FString

LocalUserConnectionId

Identifier for the local user's connection

 

FString

LocalUserContainerName

Name of the container associated with the local user

Constructors

 

Type

Name

Description

 

Type

Name

Description

 

 

FCavrnusSpaceConnection(int SpaceConnectionId)
: SpaceConnectionId(SpaceConnectionId)

  • Initializes the space connection with the specified connection ID.

  • @param SpaceConnectionId Unique identifier for the space connection.

 

 

FCavrnusSpaceConnection(int InSpaceConnectionId, const FString& InLocalUserConnectionId, const FString& InLocalUserContainerName)
: SpaceConnectionId(InSpaceConnectionId), LocalUserConnectionId(InLocalUserConnectionId), LocalUserContainerName(InLocalUserContainerName)

  • @brief Constructor with full initialization.

  • Initializes the space connection with the specified connection ID, user connection ID, and container name.

  • @param InSpaceConnectionId Unique identifier for the space connection.

  • @param InLocalUserConnectionId Identifier for the local user's connection.

  • @param InLocalUserContainerName Name of the container associated with the local user.

Remarks

  • The FCavrnusSpaceConnection is required for most API function calls: joining, leaving, fetching information, accessing properties, etc.

  • Stores information like the connection ID and associated containers.

  • Since the FCavrnusSpaceConnection takes awhile to arrive after calling JoinSpace, the best way to get a hold of it is to call AwaitAnySpaceConnection and use the result.

Sample Code

#include "CavrnusFunctionLibrary.h" // Include the library to access Cavrnus functions #include "Types/CavrnusSpaceConnection.h" // Include the definition of FCavrnusSpaceConnection // ... (other includes and class definitions) void AMyActor::JoinCavrnusSpace(const FString& SpaceId) { // Join the space (assuming you have a valid SpaceId) UCavrnusFunctionLibrary::JoinSpace(SpaceId, FOnJoinSpaceDelegate::CreateUObject(this, &AMyActor::OnJoinSpaceCompleted)); } void AMyActor::OnJoinSpaceCompleted(FCavrnusSpaceConnection SpaceConnection, bool bWasSuccessful) { if (bWasSuccessful) { // Successfully joined the space! // Store the SpaceConnection object for later use MySpaceConnection = SpaceConnection; // Access information about the space FString ContainerId = MySpaceConnection.LocalUserContainerId; int32 ConnectionId = MySpaceConnection.ConnectionId; // ... (Use the connection to interact with properties, users, etc.) } else { // Handle joining failure UE_LOG(LogTemp, Warning, TEXT("Failed to join Cavrnus space.")); } }

Â