If I lose an internet connection while the game is running GS.GameSparksAvailable is not called and GS.Available stays true but I do get messages that GameSparks is trying to connect again.
Yeah, it actually solved all our issues. I'll be still on the lookout though for a better solution.
Hey, we're experiencing a similar issue. Sending the application on iOS to the background and waiting for about 30 mins will sometimes not trigger a reconnect.
Does anyone have any thoughts on how to fix this issues?
Hey @Sean does that mean in case application is not sending any data (only waiting for a message to arrive) the sockets will never figure out they are disconnected (since no sent messages shall trigger a timeout) and not reconnect?
I am writing this because my test devices frequently lose connection to GS when on bad WIFI, switching from LTE to WIFI and vice versa. And when they regain internet connection GS does not always reconnect.
Yeah, it works now with the most recent SDK.
The issue was when a player gets disconnected I wanted let them know and then also let them know when they reconnect. GameSparks does seem to know that it's not fully connected because it tries reconnect, is there a way that I can get that info?
This isn't actually a bug, the web socket can take up to 30 minutes to close after connection has been lost, this means GS.Available will return true and can take up to that amount of time to return false, during this time GameSparks will attempt to reconnect until the socket has fully closed.
So while I can set timeouts on all message sends..and deal with failures..
after the first timeout, I would assume that GameSparksAvailable would be called (or Available would be false)...but alas it is not.
What IS the purpose of these callback/flags?
That aside - is there ANY mechanism that we can rely on so that we can give a visual representation to our player (and to our UI flow) that connectivity is a problem?
I have not yet found a solution for this. One idea I had was to trigger a disconnect on (IOS) client before going to background, but I did not test it yet. If you happen to try this Levente and it works please let me know.
Of course this will only work when client goes to background. If client looses connection for some other reason, this will not solve the problem.
We tried that already and it didn't work.
We resorted to a hack fix which includes destroying the GameSparks gameobject and then re-instancing it again when reloading the game.
I also am interested in this topic (and the answer to Shea's question above)....
I was also wondering how to really hard reset the Gamesparks module / connection. Did that work for you?
Cool Levente thank you very much for sharing!
Could you try updating to our most recent SDK?
I have tested this and i can confirm that if you connect the websocket and then disconnect, any requests after the socket is disconnected will timeout (after 10 seconds) at which point the GameSparksAvailable callback will be fired and the SDK will attempt to reconnect the socket.