Initialisation through the ComapiChat class gives you access to a client object used for any further communication with the SDK.
Learn more in Initialise.
In order to communicate with our services you must start session in the SDK. This is needed only once per user log in. After that, the SDK re-authenticates until you end the session.
Start
To register or log in user:
client.service().session().startSession(new Callback<Session>(){/* implement */});
rxClient.service().session().startSession()
.subscribe(new Observer<Session>(){/* implement */});
This asks ComapiAuthenticator - provided in ChatConfig
- for a JWT token, then the SDK creates a session server side for the profile ID obtained from the token. Any subsequent call to the services uses the same authentication details.
Stop
To close a currently opened session:
client.service().session().endSession(
new Callback<ComapiResult<Void>>(){/* implement */});
or
rxClient.service().session().endSession()
.subscribe(new Observer<ComapiResult<Void>>(){/* implement */});