Assign user to subsession returning Internal Error

Description
I am experiencing some issue when I call the ssClient.openSubsessions() function. The issue is that the users in the unassignedUserList never get reassigned to another subsession. So I tried to get the unassignedUserList and and iterate over the list and called the assignUserToSubsession(userId, subsessionId) function below.

const openSubsessions = useCallback(async () => {
if (ssClient) {
ssClient.openSubsessions(subsessions, options);
setSubsessionStatus(SubsessionStatus.InProgress);

  console.log('sub status', subsessionStatus);
  console.log('ssclient stat', ssClient.getSubsessionStatus());
  

  await assignUnassignedUsersToAnyRunningSubsessions();
}

}, [ssClient, subsessions, options, subsessionStatus, assignUnassignedUsersToAnyRunningSubsessions]);`

const assignUnassignedUsersToAnyRunningSubsessions = useCallback(() => {
console.log(‘not in any sub sessions’, unassignedUserList);
console.log(‘available subsessions’, ssClient?.getSubsessionList());
setSubsessionStatus(SubsessionStatus.InProgress);

if(ssClient) {
  if(unassignedUserList.length && ssClient.getSubsessionList().length) {
    const availableSubSessions = ssClient.getSubsessionList();
    unassignedUserList.forEach((user) => {
      const targetSubSession = Math.floor(Math.random() * availableSubSessions.length);
      const targetSubsessionId = availableSubSessions[targetSubSession].subsessionId;
      console.log('target sub', targetSubSession);
      console.log('target sub sub', availableSubSessions[targetSubSession]);
      
      assignUserToSubsession(
        user.userId,
        targetSubsessionId,
        user.displayName,
      );
    });
  }
}

}, [unassignedUserList, ssClient, assignUserToSubsession]);`

const assignUserToSubsession = useCallback(
(userId: number, subsessionId: string, displayName: string, avatar?: string) => {
console.log(‘sub status’, subsessionStatus);

  if (subsessionStatus === SubsessionStatus.InProgress) {
    if (ssClient) {
      ssClient.assignUserToSubsession(userId, subsessionId);
      console.log('passed, supposed success');
    }
  }
  setSubsessions(
    produce((subsessions: Subsession[]) => {
      const subsession = subsessions.find((r: Subsession) => r.subsessionId === subsessionId);
      if (subsession) {
        subsession.userList.push({
          userId,
          displayName,
          avatar,
          isInSubsession: false
        });
      }
    })
  );
},
[ssClient, subsessionStatus]

);`

But when I call the assignUserToSubsession, it doesn’t run the block below within the function. From the console logs which I had put within the assignUnassignedUsersToAnyRunningSubsessions function it showed that the subsessionStatus was not equal to SubsessionStatus.InProgress, even when I changed the state within the assignUnassignedUsersToAnyRunningSubsessions function.

if (subsessionStatus === SubsessionStatus.InProgress) { if (ssClient) { ssClient.assignUserToSubsession(userId, subsessionId); console.log('passed, supposed success'); } }

If I try to silence the check in the block above in order to let the sscClient.assignUserToSubsession function run by all means, it returns an INTERNAL ERROR with no message.

This is not a good behaviour for us and I hope you can help me resolve it. Our project is already beyond deadline and it seems we only keep running into these issues.

Hey @godwin.owonam

Thanks for your feedback.

I noticed that you are calling the ssClient.assignUserToSubsession method immediately after the ssClient.openSubsessions method without waiting for it to resolve. This might be the cause of the issue you are facing.

Thanks
Vic

Hi @vic.yang

I used await to resolve the ssClient.assignUserToSubsession method (which I already tried before now), and it seemed to work, and then suddenly it stopped working again.
This is very depressing.

Is there any explanation as to why this is unstable, because I have used async and await to try to resolve every method that returns a Promise/ExpectedResult

Hey @godwin.owonam

It might take some time for all the subsessions to open. So, waiting for the ssClient.assignUserToSubsession method to resolve is always the correct approach.

I’m not sure what’s happening in your case. Could you please integrate the client-side telemetry and send us the logs?

Thanks
Vic

@vic.yang
Once again thanks for your response. I have added the telemetry id, as well as the global tracing.

The Sub-session logic began to work again without doing anything more, so I would like to ask, if possible, to share a link where I can read more on this so I can handle the issues better wrt to sub-sessions. Because as of now, I can’t really tell why and why not it works and then fails. I’m keen on this because our company uses the Zoom SDKs a lot in their projects. Thanks.

Hey @godwin.owonam

Glad to hear that the issue has been resolved.

We haven’t provided a detailed description of subsession-related resources yet, only a simple functional guide. You can find it here:

Additionally, we have a more complex subsession sample available on GitHub that you can refer to:

Thanks
Vic

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.