JoinSpace (Unreal Engine)

- Declaration

static void JoinSpace(FString SpaceId, CavrnusSpaceConnected OnConnected, CavrnusError OnFailure);

Delegates Options:

DECLARE_DYNAMIC_DELEGATE_OneParam(FCavrnusSpaceConnected, FCavrnusSpaceConnection, SpaceConnection);

DECLARE_DYNAMIC_DELEGATE_OneParam(FCavrnusError, FString, Error);

typedef TFunction<void(const FCavrnusSpaceConnection&)> CavrnusSpaceConnected;

typedef TFunction<void(const FString&)> CavrnusError;

- Description

Connects to a Space; joining voice & video and receiving/processing the journal.

OnFailure is not expected to be hit unless the user does not have proper authentication to join a space.

- Blueprint Sample

 

JoinSpace.png
Join Space

- Code Sample

SpaceManager.h

#include "Types/CavrnusCallbackTypes.h" #include "Types/CavrnusSpaceConnection.h" #include "SpaceManager.generated.h" UCLASS() class MODULE_API USpaceManager { public: USpaceManager(); void JoinSpace(FString SpaceId); UFUNCTION() void OnSpaceConnectionSuccess(FCavrnusSpaceConnection SpaceConnection); UFUNCTION() void OnSpaceConnectionFailure(FString Error); private: FCavrnusSpaceConnected SpaceConnectionSuccess; FCavrnusError SpaceConnectionFailure; FCavrnusSpaceConnection CurrentConnectedSpace; };

SpaceManager.cpp

#include "SpaceManager.h" #include "CavrnusFunctionLibrary.h" USpaceManager::USpaceManager() { SpaceConnectionSuccess.BindUFunction(this, GET_FUNCTION_NAME_CHECKED(USpaceManager, OnSpaceConnectionSuccess)); SpaceConnectionFailure.BindUFunction(this, GET_FUNCTION_NAME_CHECKED(USpaceManager, OnSpaceConnectionFailure)); } void USpaceManager::JoinSpace(FString SpaceId) { UCavrnusFunctionLibrary::JoinSpace(JoinSpaceId, SpaceConnectionSuccess, SpaceConnectionFailure); } void USpaceManager::OnSpaceConnectionSuccess(FCavrnusSpaceConnection SpaceConnection) { CurrentConnectedSpace = SpaceConnection; UE_LOG(LogTemp, Log, TEXT("Successfully joined space %d!"), SpaceConnection.SpaceConnectionId); } void USpaceManager::OnSpaceConnectionFailure(FString ErrorMessage) { CurrentConnectedSpace = FCavrnusSpaceConnection(); UE_LOG(LogCavrnusConnector, Error, TEXT("Failed to join space, error: %s"), *ErrorMessage); }

Related pages