How can i get current session's setting in C++

I want to know how to get session setting after the client join the session. I want something like “get Session Settings” in blueprint.


IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();   IOnlineSessionPtr Sessions =  OnlineSub->GetSessionInterface();   FOnlineSessionSettings* sessionset = Sessions->GetSessionSettings(TEXT("set"));   float val;   sessionset->Get("name", val);

If i use this code, will it works? And if it is, where should i put this code? GameMode? PlayerController?