Runtime_ctx_session_id

How to obtain a SessionID , that is always empty ctx.Value(runtime.RUNTIME_CTX_SESSION_ID).(string)

Hello @lu-liyanghan,

Is the RPC being called from an authenticated client? How are you invoking the RPC?

RPC was called over a connected socket

Will it have an impact if the FRPS internal network penetrates and jumps

Can you please provide the versions of the SDK and Nakama you’re using? I can’t see a reason why it would be empty.

After further inspection, the way you’re setting up the socket seems incorrect. Please have a look at our docs, you need to authenticate the user in some way to get a session and then use the session when creating the socket.



server: nakama-pluginbuilder:3.16.0

Looks correct, are you sure your custom server code is being loaded correctly? Could you share where in the server code you’re calling ctx.Value(runtime.RUNTIME_CTX_SESSION_ID) and how you’re registering that function?


It’s likely there’s something wrong with the RPC code you’re registering or how you’re invoking the RPC via the websocket connection.


Thanks