crisp-im / crisp-sdk-android

:package: Crisp Android SDK, add a chat in any Android app and communicate with your users.
https://docs.crisp.chat/guides/chatbox-sdks/android-sdk/
Other
55 stars 17 forks source link

Improve documentation about session events #176

Closed gekylafas closed 2 weeks ago

gekylafas commented 2 weeks ago

I am trying to send session events from my app, but I can't understand when the events are actually sent and visible to the Crisp console.

The function I am using is Crisp.pushSessionEvent(SessionEvent event). There is no documentation about this function other than the simple (and not terribly englightening):

Sends the session events provided.

The documentation for the whole session section consists of the following cryptic message:

Those methods are performed right away if the socket is already connected, when the session is joined otherwise unless you called one of these methods:

What does this sentence mean?

Also, when is the "socket already connected"? Does this mean at the moment the chat window is opened? If yes, does this also mean that session events are not sent until the user opens the chat?! If yes, how can I trigger the sending of events right away?

Doc1faux commented 2 weeks ago

Hi @gekylafas,

Session events, as well as any other method you can find in the Session and User methods of our wiki are sent only when the socket is connected, so when the user has opened the chatbox indeed. As soon as he closes it, the socket is also closed. For info, a session:loaded callback is planned for the next release as discussed in #169.

There is no way to send events right away unless the user have the chatbox opened because we cannot leave the socket opened during the whole app lifecycle and REST calls are not available for them for the moment. However, unless you reset the session or switch website, these events are cached and will be sent in the next chatbox opening, that's what the Session and User methods header meant.

gekylafas commented 2 weeks ago

OK, thanks for the clarification! I'd suggest copying this detailed explanation to the Wiki too, so that it's more easily accessble than searching though issues. If you don't plan to do it, however, you may close this issue.

Doc1faux commented 2 weeks ago

I've updated the wiki section, I hope it is more intelligible :)

gekylafas commented 2 weeks ago

Thanks, it's much better now. I am closing the issue.