Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

Background service doesn't stop in iOS

$
0
0

I'm using socket.io-client in react-native to start a chat room, when the app enters in background mode the socket keeps working, no problem, but when I disconnect the socket yet the foreground mode still stays active. I have tried a lot of ways but none deactivated the background service.

Follow the code who call the socket:

socket = null;

socketConnection = (url) => {
    socket = io(url, { forceNew: true });

    socket.on('connect', () => {
        console.warn("Connected: ", socket.connected);
    });
    socket.on('disconnect', () => {
        console.warn("Disconnected: ", socket.disconnected);
    });
}

socketDisconnect = () => {
    socket.disconnect();
    socket.off("connect");
    socket.off("disconnect");
}

Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>