Sessionid always = -1?

in my webgl code, I’m trying to get convainpc.sessionid, but it is always -1 even after i can see the session id change in thebrowser console (from JS call?)

it seems like it isn’t updating after initialization, is there a better place to pull this sessionid?

Hello @chris.raasch,

Currently, ConvaiNPC.cs does not update with the latest session ID.

The Session ID you see in the browser log comes from a console.log message in JSLib.

To properly pass the Session ID to ConvaiGRPCWebAPI, modify Assets/Convai/Plugins/WebGL/ConvaiUnityWebGL.jslib by adding a SendMessage call.

Find this section in your JSLib code and insert the SendMessage function:

if (responseText != "") {
    console.log("Response Text: " + responseText);
    console.log("Session ID: ", response.getSessionId());
    
    // Example
    SendMessage("ConvaiGRPCWebAPI", "SessionIDReceived", response.getSessionId());
}

Also, ensure that ConvaiGRPCWebAPI has a method called SessionIDReceived to properly handle the session ID update.