Is possible to call the updateStatus from GO?


we would like to update the Presence status via our RPC function.
So, not call from Unreal Client this:


But we want to call our RPC function which modify metadata and call updateStatus in one step.Like this:

Client->RPC(Session, "update_metadata", "{location:game}", RpcSuccessDelegate, RpcErrorDelegate);

And in GO, we process this RPC function “update_metadata” and immediately call something like updateStatus(payload).

Is this possible call presence functions from GO server?

Hi, @j4c0b.

Could you please elaborate in more detail what the goal is so a more appropriate solution can be suggested?


From Unreal, I call

Client->RPC(Session, "update_metadata", "{location:game}", RpcSuccessDelegate, RpcErrorDelegate);

and in GO, I process it like in example

initializer.RegisterRpc("UpdateMetadata", func(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, payload string) (string, error) {
    userId, ok := ctx.Value(runtime.RUNTIME_CTX_USER_ID).(string)
    if !ok {
        return "", errors.New("could not get user ID from context")

    if err := nk.AccountUpdateId(ctx, userId, "", map[string]interface{}{
        "title": "Definitely Not The Imposter",
        "hat":  "space_helmet"
        "skin": "alien"},
    }, "", "", "", "", ""); err != nil {
        return "", errors.New("could not update account")

// and here I want to call something like
// rtClient->updateStatus("I have new metadata");

    return "{}", nil

I’m still not sure what the intention of your proposed solution is but if you need to update the status of a user, it can be done on the client. It would add one RPC call but would also keep it simple in terms of server code since this feature (updateStatus) is already implemented on Nakama server and client libraries (no need for custom code).


I need to update my Metadata via RPC function “UpdateMetadata” like in my case above.
And when I update my data, I need every my friend (which follows me) gets the information like “your friend j4c0b updated his metadata”.

I think the best way is via Presence via updateStatus, which can be called from client. You are right.

But I want to do this in one step. I would like to call from client only RPC function “UpdateMetadata” which should call updateStatus(). But how I can get RealTimeClient in my RPC function in GO?

For me, it is much better than call 2 functions from client in callbacks like

FOnRPC RpcSuccessDelegate;
RpcSuccessDelegate.AddDynamic(this, &ASagiShiActor::OnRpcSuccess);

FOnError RpcErrorDelegate;
RpcErrorDelegate.AddDynamic(this, &ASagiShiActor::OnRpcError);

Client->RPC(Session, "EquipHat", "<PayloadString>", RpcSuccessDelegate, RpcErrorDelegate);

/* Delegate handlers */

void ASagiShiActor::OnRpcSuccess(const FNakamaRPC& RPC)
	UE_LOG(LogTemp, Log, TEXT("New hat successfully equipped"));

	FOnSetStatus success;
	success.AddDynamic(this, &ASagiShiActor::OnSetStatusSuccess);

	FOnRtError error;
	error.AddDynamic(this, &ASagiShiActor::OnSetStatusError);
	RealtimeClient->UpdateStatus(TEXT("xjs test"), success, error);

void ASagiShiActor::OnRpcError(const FNakamaError& Error)
	UE_LOG(LogTemp, Error, TEXT("Error reading storage objects: %s"), *Error.Message);

void ASagiShiActor::OnSetStatusSuccess()
	UE_LOG(LogTemp, Log, TEXT("New status successfully set"));

void ASagiShiActor::OnSetStatusError(const FNakamaRtError& error)
	UE_LOG(LogTemp, Error, TEXT("Error set status: %s"), *Error.Message);

This is very annoying.

@j4c0b I think notifications would serve your use case well.

@sesposito Thanks, perhaps it helps.
But when I use notifications, is there any notification for all users who follow me?

rtClient->followUsers({ "<user id>" }, successCallback);


rtClient->updateStatus("Hello everyone!");

works as “notification” for followers. And I need this.

However, there is still a question. Is it possible to call functions from RealtimeClient in GO server somehow?

Yes, you can invoke custom RPCs from the socket connection.

To use the Notifications API you need to know the users you want to send the data to. If this is all of your friends then you can use the runtime friend listing API and send the notifications with the persist flag to false, so only the ones that are connected to the socket will receive it and it won’t be stored for offline retrieval.

To send the status update from the server you’d need to use streams.