Streams - Context session_id

I attempted to connect a user to a stream on the server. For that, I needed the user’s ID and the unique session ID of the user’s current session. I wrote an rpc method in lua which handles the context as an argument, and I do realize that the session id is available if an RPC function is called from a socket connection. Knowing all that, I was able to retrieve the user_id from the context object but I also expected to retrieve the session_id from the context (context.session_id) and pass both to the nk.stream_user_join to do the simple process of joining my user to the stream… However, the session_id was not even present. I would like to know why this happened and how can I attempt to solve this? I did try to send the session token manually to the server (with the payload) and pass it in as an arguement but that also failed.

Note: This is the method i was attempting to call
nk.stream_user_join(context.user_id, context.session_id, stream_id, hidden, persistence)

@zouelfikar We spoke on the community channel but just for anyone that comes across this forum thread you need to execute the RPC function on a socket connection. A socket contains the session ID for the socket handle managed by the game server.

1 Like