What happens when a user is offline?

What happens when a user is offline? How do things work then?

Hey @YATISH_GOEL, ChatKitty needs an internet connection to work. However, ChatKitty also has automatic retries, so if a user briefly loses their internet connection and reconnects, messages created in the interim period are sent.

  1. Do these automatic retries require CFIs.
  2. By my initial question I meant to ask what if a user is connected to the internet but has closed the app.
    A. What is the flow that happens then?
    B. How is he or she notified of messages.
    C. How are messages sent?
    D. Does this require CFI?
    All of these are for web and mobile both.

E. What happens for web if the notifications are disabled and browser is closed or if browser is open but tab is closed.
3. How many times the retries happen? What is the mechanism and timings for retries?
4. Will retries keep happening if user is offline with a chat connection being closed properly vs when chat connection is open and the user loses internet connectivity is lost (transient or due to switching off of the internet connection)
5. Does the client attempt to reconnect? What is the battery and CPU/ RAM memory usage in such a case?

  1. No, they do not. Chat Functions is a specific feature that lets you integrate external systems into ChatKitty. You don’t require them to use most of ChatKitty.

  2. Once the user is no longer connected to ChatKitty, the user goes offline. The user is then able to get notified via push notifications. You can implement push notifications with chat functions. This article covers implementing push notifications with Expo Building a Chat App with React Native and Expo (Part 3) | ChatKitty

  3. The retries are infinite. The mechanism and timings aren’t exposed and vary based on what works for most customers.

  4. If the user properly ended their ChatKitty session, then no retries are made. It only happens for transient connection issues.

  5. Yes, the client attempts to reconnect. Battery and CPU usage during retries will depend on multiple factors like the user’s device and OS. RAM usage isn’t very relevant here.

Thank you for your response.

Could you please re-edit your post with answers matching the question numbers and sub numbers. In long threads or when there are multiple questions, it can become very difficult to track questions and answers if numbering gets mixed up.

Additional points or questions not within the numbered points can receive an incremental numbering.

Just went through your previous answer again with a fresh perspective. The answers are properly numbered. Sorry for the confusion.

Once the user is no longer connected to ChatKitty, the user goes offline.

How is this determined. We need to have better terminology such as
I. offline with proper closure of connections,
II. offline while earlier online due to network issues,
III. offline while earlier online due to internet connection being switched off by user or mobile,
IV. online and not connected with proper closure of the connections,
V. online and not connected with improper closure of connections (app is killed by user or force killed or crashed),
VI. online and connected.

Please go through and address behaviour for each use case.

The retries are controlled by kitty.startSession({ ... }) and kitty.endSession().

Retries happen if the underlying network connection to ChatKitty is lost any time between when you start a user session and when you end it.

  1. Are these retries designed to be efficient on battery for client? Are industry standards used?

  2. What if someone starts the session, but the session is never ended. However the app has been closed by the user using the app close functionality of the OS.

  3. My interpretation basis your response
    Define: Client A and Client B. Client A is the one where these use cases are occurring.
    I. offline with proper closure of connections - happy case, no push notifications received

II. offline while earlier online due to network issues, -
a. retries by client A if app is open, no retries by client A if app is killed.
b. What happens to client B, does it send the message to your server or does it attempt to send the message to client A?
c. This brings the question what is the underlying nature of your connections. Client to Chat Kitty Server or Client to Client once server does the negotiation.
d. Is the session between client and server?
e. If a session between client and server is on, is that a concurrent connection or is a concurrent connection between two clients?

III. offline while earlier online due to internet connection being switched off by user or mobile - what happens to retries by client A and client B here.

IV. online and not connected with proper closure of the connections - happy case, push notifications received.
a. Is the message also sent to the app in this case or are messages only sent when a connection is re-established?

V. online and not connected with improper closure of connections (app is killed by user or force killed or crashed), -
a. What happens to the open session? Does server or client B retry to connect with the client A or is the connection attempt always from client in case of client-server connection?
b. How long does the server attempt to connect with the client?
c. What happens to client B, does it send the message to your server or does it attempt to send the message to client A?

VI. online and connected - happy case.