livechat / chat-window-ios

Embeding LiveChat mobile chat window in iOS application
MIT License
24 stars 31 forks source link

Receiving messages when app is in background #10

Closed j-rewerts closed 6 years ago

j-rewerts commented 6 years ago

I'm currently trying to allow notifications in my iOS app. If a visitor is using the app and closes it, I'd like them to receive notifications when an agent responds to them at least for a short while after closing the app.

j-rewerts commented 6 years ago

In order to test an easy implementation of this, I've added UIApplication.shared.beginBackgroundTask to the class that implements LiveChatDelegate. The code in my delegate continues to run when the app is closed, but I no longer receive any messages.

j-rewerts commented 6 years ago

I've confirmed this on an iPhone 5, iOS version 10.3.3.

Jercik commented 6 years ago

Hi, unfortunately it is not possible to receive messages while app is in background. This chat widget works by running JavaScript code in hidden WKWebView, and WKWebView just stop executing any code when app enters background.