Web Socket gets disconnected when app is in background

1.4k views Asked by At

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.

0

There are 0 answers