Unable to/How to join a different Scroll Sync Session

Product:
PDFTron Collab Client
Product Version: 2.0.0-alpha.13

Please give a brief summary of your issue:
A new scrollSyncSession is created by the Leader and as a follower, I want to join that new session. Get Error on join()

Please describe your issue and provide steps to reproduce it:
As a follower I have joined a session by the leader, and I am able to join the first session.
A new scrollSyncSession is created by the Leader and as a follower, I want to join that new session.
When I attempt join() the new session, this is the error I receive:

Error: Cannot return null for non-nullable field ScrollSyncSession.leaderId.

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Please see latest edit.

Hello brooke.harris,

Can you provide the code you are using to try to join the scroll sync session?
We have an example here in the react sample: useCurrentScrollSyncSession | WebViewer Real-time Collaboration

Best regards,
Tyler Gordon
Web Development Support Engineer
PDFTron

Below is the code snippets we us to join and exit from the session.
We have noticed that active sessions list will occasionally contain 2 sessions of the same session ID so perhaps those are conflicting.
Regarding the useCurrentScrollSyncSession hook, yarn is telling us it can’t be found: error An unexpected error occurred: " https://registry.yarnpkg.com/@pdftron%2fcollab-react : Not found".
Is the package publicly accessible?

-----------------------CODE SNIPPET---------------------------

// when mode changes destroy or create a new scrollSyncSession or subscribe to newest
useEffect(() => {
  (async () => {
    if (!client || !document) {
      return;
    }
    if (mode === 'free') {
      stopSession();
      return;
    }

    if (
      (mode === 'my' && sharedByMe) ||
      (mode === 'witness' && isWitness())
    ) {
      if (client.ScrollSyncManager.activeSession) {
        stopSession();
      }

      session.current = await document.createScrollSyncSession();
    } else {
      const availableSessions = client.ScrollSyncManager.availableSessions;

      if (availableSessions?.length) {
        console.log(
          'new availableSessions?.length: ',
          availableSessions?.length
        );
        const index = availableSessions.length - 1;

        const availableSession = availableSessions[index];

        if (client.ScrollSyncManager?.activeSession !== availableSession) {
          stopSession();
        }

        if (client.ScrollSyncManager.canJoinSession) {
          try {
            await availableSession.join();
          } catch (e) {
            console.log('newest availableSession.join() error: ', e);
          }

          session.current = availableSession;
        }
      }
    }
  })();
}, [mode, client, document]);


// listen for scrollSyncSessionsChanged, and subscribe if not free and current user is not controller
useEffect(() => {
  // just want to check if creation and initial join works
  /*return;
  console.log('listen for scrollSyncSessionsChanged!!', lastSessionPing, mode)*/

  if (!client || !document) {
    return;
  }
  if (mode === 'free') {
    // if free, nothing.... above useEffect will stop the session
    return;
  }

  if ((mode === 'my' && sharedByMe) || (mode === 'witness' && isWitness())) {
    // if I am controller I have started session in above useEffect, I do not need to subscribe to anything here, that will remove my control.
    return;
  }

  const availableSessions = client.ScrollSyncManager.availableSessions;

  if (availableSessions?.length) {
    console.log(
      'restart availableSessions?.length: ',
      availableSessions?.length
    );
    console.log('active session: ', client?.ScrollSyncManager.activeSession);
    console.log(' session: ', session);
    console.log('availableSessions: ', availableSessions);
    console.log('=======================================================');
    const index = availableSessions.length - 1;

    const availableSession = availableSessions[index];

    if (
      client.ScrollSyncManager?.activeSession &&
      client.ScrollSyncManager?.activeSession !== availableSession
    ) {
      stopSession();
    }

    if (client.ScrollSyncManager.canJoinSession) {
      (async () => {
        try {
          await availableSession.join();
        } catch (e) {
          console.log('restart availableSession.join() error: ', e);
        }
      })();

      session.current = availableSession;
    }
  }
}, [lastSessionPing, client, document]);

------------------------SCREENSHOT------------------------------

what is the stable release version for @pdftron/collab-client?

Hello brooke.harris,

My apologies, it looks like our collab-react sample has been removed from the yarn registry since Collab is not deprecated.

You can get the current available scroll sessions with: Scroll Synchronization | WebViewer Real-time Collaboration
And then joining those available scroll sessions using: Scroll Synchronization | WebViewer Real-time Collaboration

The latest stable version is: 2.3.0-alpha.1

Best regards,
Tyler Gordon
Web Development Support Engineer
PDFTron

Hey, I’m the working scrum master for the team here and the above issue is a major blocker for our current sprint. So if we are still having issues is somebody available to jump on a call and do a screen share? Also, should we be worried that the library is now deprecated? Are there plans to continue with something else? How long will it be supported? Thanks!

@pdftron/collab-client is deprecated and is no longer supported.

We have built a signification portion of our functionality off of the collab-client package. Will @pdftron/collab-client continue to be supported or is there a package that will replace this functionality?

Andrey here, Director of Product at PDFTron. I am free to jump on a call to walk through your options for building out collab: Calendly - Andrey Safonov. If you do not find time on Calendly, I can try to move things around. I am in EST timezone.

Hello brooke.harris,

Thank you for your patience, we have some questions and debugging steps:

  1. Exactly what steps are the leader and follower doing to get to this point?
  2. When the leader creates a new session, are they exiting/ending the first session first?
  3. When the follower joins the new session, have they exited out of the first session? (This should happen automatically by the client)

Can you also try these steps:

  • Can you please enable debug logs on the server like so:
const server = new CollabServer({
   logLevel: CollabServer.LogLevels.DEBUG,
   filterLogsByTag: CollabServer.LogTags.SCROLL_SYNC,
 })

and then reproduce and send us any logs they see on both the server and client.

  • Can you also try the latest version?

Best regards,
Tyler Gordon
Web Development Support Engineer
PDFTron