At the core, Layer acts as a big synchronization engine. We store a local copy of conversations and messages on each device, and all the fetching of conversations and messages occurs locally.
- If the authenticated user sends a message, the change gets stored locally and then the change gets queued to up be sent to the Layer server.
- Similarly, if a participant sends a message then the conversation updates gets brought down to the device when the Layer client does a sync.
- When the developer asks for list of conversations or messages in a conversation, those operations happen locally so we're never retrieving messages from the server.
Layer handles all network connectivity so you don't need to worry about it. If messages are sent while offline Layer will automatically queue up the messages for delivery. Our SDK will send the messages as soon as it gets a network connection. The Layer SDK also surfaces delegate methods on iOS and listeners on Android relative to connectivity.