Sign In Register

How can we help you today?

Start a new topic

iOS SDK cannot detect connection lost and reconnect in some cases

Hi


I found that in some bad networks, iOS SDK cannot detect connection lost and cannot reconnect again even manually call "disconnect" then "connect".


Test with GSExample iOS Project:


0. I used an iPhone A as the hotspot and the other iPhone B as the UDT which connect to iPhone A via wifi,

So I can use the network link conditioner of iPhone A (Ref: https://www.natashatherobot.com/simulate-bad-network-ios-simulator/), to simulate bad network.


1. iPhone A set to normal network, iPhone B launch app, iPhone B press "connect" button, connected to server.

2. iPhone A set to 100% loss network, iPhone B press "disconnect", the SDK cannot disconnect.

3. iPhone B press "connect", still no response from SDK.

4. iPhone A set back to normal network, iPhone B no response. (At least I waited for 3 mins)


My real project encounters this case. If it ran into the case, I cannot send any request (always timeout) even the network is back to normal. The "keep alive" behaviour seems not to check anything.


Please help.

Thanks

Jo



1 person has this problem

Hi Jo,


Just to let you know this issue has been addressed, you can update the SDK here.


Thanks,

Liam

Hi Liam,


Thanks for quick response.

But the updated SDK only fixed few issues.


What I expected is that the SDK can detect the connection is lost ASAP, and automatically reconnect ASAP when network is back.


I tried the experiment again without manually press "disconnect" and "connect". 

1. the SDK cannot detect the connection lost.

After I set network to 100% loss, the SDK took over 10 mins to inform the availability is gone.


2. The SDK took over 2 mins to auto reconnect after the network is back to normal.


Please help

Thanks,

Jo

I am not able to connect to GS. I am using Swift Xcode project. Getting Web socket closed and some html tags display.


here is my code, I have removed all my keys & credential in below code.


let gs = GS.init(apiKey: "------", andApiSecret: "-------", andCredential:"------", andPreviewMode: true)

        gs?.setDebugLogCallback({ (string) in

            print("debug" + string!)

        })

        


        

        gs?.setAvailabilityListener({ (available) in

            if(available)

            {

                print ("GP available")

            }

            else{

              print ("GP unavailable")

            }

        })

        

        gs?.setAuthenticatedListener({ (playerID) in

            print ("Player authenticated" + playerID!)

        })

        

        

        let messageListener = GSMessageListener.init()

        messageListener.onGSScriptMessage { (message) in

        }

        

        gs?.setMessageListener(messageListener)

        gs?.connect()










Login to post a comment