# Updating / Downloading Messages in the background?

**URL:** <https://community.sendbird.com/t/updating-downloading-messages-in-the-background/224>\
**Category:** iOS\
**Tags:** push-notification, syncmanager, chatsdk\
**Created:** [April 25, 2020, 3:15am UTC](https://community.sendbird.com/t/updating-downloading-messages-in-the-background/224 "2020-04-25T03:15:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/jay_s/32/119_2.png) [@Jay\_S](https://community.sendbird.com/u/Jay_S)\
**Post date:** [April 25, 2020, 3:15am UTC](https://community.sendbird.com/t/updating-downloading-messages-in-the-background/224/1 "2020-04-25T03:15:30Z")

</div>

How does Sendbird handle updating messages in the background? We can receive a push notification in the background, but trying to add the updated last message to the channel doesn’t work when we try to use SendbirdSyncManager after receiving the new message.

The goal we’re trying to accomplish is caching messages and files associated with them the second that a message comes in, even if the app is in the background. While documentation seems to hint that this is possible, we can’t get our shared instance of the SendBird client to call its delegate functions and update the cache. Thanks so much to anyone who can help.

---

<div class="post-metadata">

**Author:** ![eric.kim](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/eric.kim/32/8_2.png) [@eric.kim](https://community.sendbird.com/u/eric.kim)\
**Post date:** [April 28, 2020, 7:40pm UTC](https://community.sendbird.com/t/updating-downloading-messages-in-the-background/224/2 "2020-04-28T19:40:03Z")

</div>

@Jay_S Hi, Could you share what platform are you working to get this accomplished? (i.e. JavaScript, iOS, Android)?

---

<div class="post-metadata">

**Author:** ![Jay\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/jay_s/32/119_2.png) [@Jay\_S](https://community.sendbird.com/u/Jay_S)\
**Post date:** [April 28, 2020, 10:22pm UTC](https://community.sendbird.com/t/updating-downloading-messages-in-the-background/224/3 "2020-04-28T22:22:40Z")

</div>

Oh, my apologies, it’s with iOS.

> **[SyncManager Getting Started | iOS Chat SDK Documentation | Sendbird](https://docs.sendbird.com/ios/sync_manager_getting_started#3_how_it_works_4_background_sync)**
>
> \[object Object\] is a Sendbird Chat SDK add-on for chat data synchronization that allows you to reliably cache group channels and messages in your iOS client app with minimal effort. When SyncManager is added to your client app, it listens to the...

Background sync is mentioned here, and maybe this is a very open ended question, but let’s say that we have a class with a shared instance, and all of the channels are accessed via SendbirdManager.shared.channels (SendbirdManager is a class that we wrote that conforms to Sendbird delegates, so we could update the channels no matter what view controller the user is on). Once the app is in the background, the shared instance of SendbirdManager is gone. The delegates from SendbirdSync do not get called in the background, they are only called when the app starts up again. We are not sure what to do to cache these incoming messages if the app is in the background but not fully quit. Is there a cache in SendbirdSync that we should be looking at?

To be more specific, when using Facebook Messenger, Telegram, iMessage, or WhatsApp, if the user receives a message then opens the app, the message is already there and the user doesn’t have to wait a couple of seconds for it to show up. We want to update the message collection in the background so when the user returns the message is already there and we don’t have the current delay of 1-2 seconds.

---

<div class="post-metadata">

**Author:** ![Jay\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/jay_s/32/119_2.png) [@Jay\_S](https://community.sendbird.com/u/Jay_S)\
**Post date:** [April 30, 2020, 10:33pm UTC](https://community.sendbird.com/t/updating-downloading-messages-in-the-background/224/4 "2020-04-30T22:33:03Z")

</div>

I have reached a solution after talking to SendBird support, thank you. The functionality I’m seeking is not possible with SendBird or most chat SDKs because that would require people staying connected to SendBird even when the app isn’t open, which could push the number of connected users up very quickly. The apps I listed above use a custom chat implementation, which makes it possible for them.

---

<div class="post-metadata">

**Author:** ![Woo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/woo/32/125_2.png) [@Woo](https://community.sendbird.com/u/Woo)\
**Post date:** [May 1, 2020, 4:44am UTC](https://community.sendbird.com/t/updating-downloading-messages-in-the-background/224/5 "2020-05-01T04:44:43Z")

</div>

@Jay_S Hi Jay.

There is a workaround even though SendBird does not officially supports background fetching itself.

For instance, you can enable background fetching and remote notification capability for your iOS application. Then when you receive a push notification from Sendbird server, you can run background fetching and get messages (you can either fetch channel to get last message or get list of messages) through Sendbird SDK.
