1

I am using StarScream library for socket connection. [https://github.com/daltoniam/Starscream][1]

It is working fine as expected but as soon as app goes in background it gets disconnected immediately, i tried setting background process permission as well but it didn't work.

Also when i disconnect it continues to receive the messages from server.

if socket != nil{
    
    socket.delegate = nil
    socket.disconnect()
    socket = nil
}

How to handle the situation where user is chatting with an agent and it goes to background and when he came back, can resume from where he left including all the chats he missed in that time range

Any help will be appreciated, Thanks.

Arasuvel
  • 2,971
  • 1
  • 25
  • 40
Soniya
  • 600
  • 7
  • 34
  • You will need to reestablish the socket connection when your app returns to the foreground, identify the session and receive the updates. An app is suspended when it is not on screen and cannot keep a web socket open. – Paulw11 Apr 25 '22 at 05:23
  • Thanks @Paulw11, From your comment, I concluded that it's not possible to keep socket open all the time, I have to recreate it to continue. – Soniya Apr 25 '22 at 05:31

0 Answers0