How to cancel joining a session?

Video SDK Type and Version

Android 2.2.5, but applicable to newer.

Description
After calling sdk.joinSession(sessionContext)how can I cancel the join?

An example use case is where a timeout is implemented if the session takes a long time to join. We’d like to know that the sdk won’t connect to a session later on.

An alternative situation, a user initiates joining a call, but then navigates back and as the view is destructed the cleanup would have called sdk.leaveSession(false). Would that cancel an in-progress joinSession or would we end up with an orphaned session?

Thanks,
Michael

@vic.yang is this something you can comment on?
Thanks,
Michael

Hi @Michael42

Thanks for your feedback.

Since I am not very experienced in Video SDK Android, @ticorrian.heard could you help take a look?

Thanks
Vic

1 Like

Hi @Michael42 the connection to the Zoom sessions follows nearly the same flow as the web. There is no explicit method for cancelling the join but if the connecting client is disconnect due to a component being destroyed, the connection to the session would not complete. If the connection does complete (i.e you receive the onSessionJoin message in your listener), the session uses keep alives to keep the user connected. If they are disconnected, there may be a delay before the actual user is automatically disconnected by the server.

1 Like

Thanks @ticorrian.heard. Suppose we hit a race condition where a component is destroyed just as the connection succeeds, I’m worried about the connection succeeding but the code to do any cleanup has just been destroyed, leaving an orphaned session running. Am I right that all the zoom listener callbacks will run on the main thread? So if the component is destroyed on the main thread then that won’t be a concern?

If that’s not the case, I’d probably architect a session manager that is long lived and holds the listeners. Then I can try joining the session, and if we have a timeout or the user navigates back, the view will be destroyed but we’ll keep the handle on the session until either the connection fails and fires the onError listener, or succeeds in which case the session manager can immediately leave.

Good question, the SDK and all public methods must be called on the main thread. The listeners callbacks I believe run on the main thread as well but I can double check that for you.

Hi, were you able to check that?

Hi @Michael42 sorry for the delay, yes I confirmed that the callbacks will happen on main thread.

Great, thank you very much!