Sign In Register

How can we help you today?

Start a new topic

Disconnection after 5 minutes [Corona]

Hello guys,

I'm exploring the GameSparks API and I'm working on my first GameSparks implementation, on a Corona application.

I'm using the real-time API, for a 1vs1 game.

My first attempts are successful but the two players systematically lose connection after 5 minutes (Websocket closed).

I can handle an auto-reconnection but I did not find a way to match the two same players again.


Is there a way to avoid this 5 minutes delay disconnection?

Is there a way to force the two players to be reconnected together on disconnection?


Thanks!


Having the same problem, Websocket closes every 5 minutes
Anyone found a solution?

 

Hi Damiano,

I Actually found a workaround that works like a charm. I will share what I did as soon as I can, on that thread.

(working with Corona SDK)


Alistair

 OK, I'll be waiting for news. Thank You
The main problem I have is with this function

local function accountInfo()
  local requestBuilder = gs.getRequestBuilder()
  local accountInfoRequest = requestBuilder.createAccountDetailsRequest()
  accountInfoRequest:send(function(response)
    --Get virtual goods table, loop through it, and print the values in it
    local vGoods = response:getVirtualGoods()
    print("Virtual Goods: ")
    for vGood, quantity in pairs(vGoods) do
      print(vGood)
    end
  end)
end

It works fine until the Websocket closes, after that happens the vGoods is considered 'nil'

Hi Damiano,

on my side I'm using only Gamesparks RT features for now.

Basically, two players are connected and play a solitaire cards game in the same time. Each point that is earned triggers an action on the opponent side. Special bonuses trigger remote actions as well.


After 5 minutes, I have a websocket disconnection. Letting the system reconnect by itself was not a valid option since any of the other available players could be picked up.


To solve that issue, I enabled the "Manually match players" of the RT match to handle the match from the client.


Here is the chronology of the requests that the client does :


1 Authentication (by DeviceID in my case)

2 CreateMatchmaking Request

3 CreateFindPendingMatches Request

4 CreateJoinPendingMatch Request (when available...)


The trick is done in the MatchFoundMessage Handler where I store the match ID.


When a reconnection occurs, the steps 1-2-3-4 are triggered again and I use this stored match ID for the steps 2-3-4, to set the match group and to force the two players reconnection.


I'm using the match ID as a match GROUP.


Hope that helps.


Alistair



Nice! That's helpful for rematching the same players. Thank You!

Still don't know what causes response:getVirtualGoods() and response:getCurrencies() to be nil after the websocket closes and reconnects, I'll think about that later.

Thanks for the help!

Login to post a comment