Package 

Class SessionHandler


  • 
    public abstract class SessionHandler
    
                        

    A handler required on refreshing the session key on expiration. This should be added by {@link SendBird#setSessionHandler(SessionHandler)} before the connection.

    • {@link SendBird#connect(String, String, SendBird.ConnectHandler)}.

    • {@link SendBird#connect(String, String, String, String, SendBird.ConnectHandler)}.

    since 3.0.150

    • Constructor Summary

      Constructors 
      Constructor Description
      SessionHandler()
    • Method Summary

      Modifier and Type Method Description
      abstract Unit onSessionTokenRequired(SessionTokenRequester sessionTokenRequester) App needs to fetch a new token and pass on the new token to SDK via SessionTokenRequester.onSuccess, or SessionTokenRequester.onFail if error has occurred during the fetch.
      abstract Unit onSessionClosed() Called when:
      • the token has been revoked

      • the app has returned null as a new token value on SessionTokenRequester.onSuccess.

      SDK disconnects the connection before calling this callback by com.sendbird.android.SendBird.disconnect, so the app is recommended to direct a user to a login page to connect again.
      Unit onSessionExpired() Called when the session has expired.
      Unit onSessionRefreshed() Called after SDK successfully refreshes the session key.
      Unit onSessionError(SendBirdException sendbirdException) Called when the SDK runs into an error while refreshing the session key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SessionHandler

        SessionHandler()
    • Method Detail

      • onSessionTokenRequired

         abstract Unit onSessionTokenRequired(SessionTokenRequester sessionTokenRequester)

        App needs to fetch a new token and pass on the new token to SDK via SessionTokenRequester.onSuccess, or SessionTokenRequester.onFail if error has occurred during the fetch.

        In case when app decides not to refresh the session for the user, they should call SessionTokenRequester.onSuccess with null as a token value.

        since 3.0.150

      • onSessionClosed

         abstract Unit onSessionClosed()

        Called when:

        • the token has been revoked

        • the app has returned null as a new token value on SessionTokenRequester.onSuccess.

        SDK disconnects the connection before calling this callback by com.sendbird.android.SendBird.disconnect, so the app is recommended to direct a user to a login page to connect again.

        since 3.0.150

      • onSessionExpired

        @Deprecated(message = As of 3.0.173, this will no longer be called.) Unit onSessionExpired()

        Called when the session has expired. The session refresh process will proceed, and .onSessionRefreshed will be called once the session is refreshed. .onSessionTokenRequired will be called if new session token is required to refresh the session.

        since 3.0.150

      • onSessionRefreshed

         Unit onSessionRefreshed()

        Called after SDK successfully refreshes the session key.

        since 3.0.150