Reconnect to room on a Relay Server
-
Hi Alessio,
Thanks for the use case clarification - our folks are attempting to replicate the scenario. Certainly the intention is that that reconnect should work - the Relay Server should have the initial collection of members from the lobby cached.
Question - how are you disconnecting "Player B" for network reasons? Would it involve them re-authenticating - and thus getting a new brainCloud session? (If so - that changes the id we call their "cx" - which combines their profileId:sessionId - and is likely the reason the reconnect is failing).
If they were to reconnect without re-authenticating - it would probably work...
(Note - we haven't confirmed that yet - but it's our working theory.)
And to answer your question - yes, a server can host multiple rooms. It is controlled via the "Containers Per Server" property when defining the server on the My Servers page.
Paul.
-
Also Alessio, can you confirm whether your lobby type has the "Allow join in progress" Rule enabled or disabled? That's also relevant. Thanks!
-
Hi Paul & Greg,
-
player B re-authenticates, so I assume that his "cx" changes. Is it possible to ensure that the player can re-enter the room even by re-authenticating? If you have a unique passcode, could you use that?
-
"Allow join in progress" is true
Regarding the number of rooms, so in practice you can have a maximum of 2500 simultaneous rooms (50 "Max servers" x 50 "Containers per Server"), right?
Thank you!
-
-
Hi Alessio,
I think we've identified your test app and lobby. We believe that both
Disband at Start
Allow join in progressare enabled for that lobby. Unfortunately - they shouldn't be - this is a regression in Portal-X - it should be disallowing that combo.
So what we believe is happening is player B is re-authenticating before attempting to re-connect.
Because Player B now has a new session, he/she also has a new connection id (i.e. cx) - and the Relay Server seems them as a new person.
Because "Allow Join in Progress" is enabled - the Relay Server attempts to contact the lobby to see if this user is valid - but that lobby doesn't exist anymore - and we get the error you are seeing... (which is maybe not the best error message).
Disabling "Allow join in progress" will result in a more understandable error message - but probably won't fix the problem.
The real trick to this scenario would be for the network re-connect to the room server to happen without recreating the CX - but depending upon the type of network failure that is probably unavoidable.
The devs are looking into options.
Paul.
-
Thanks Paul, I really appreciate it.
Bear in mind that the player could also disconnect due to a crash or the mobile device being turned off, so the possibility of re-entering the room even after having performed a new authentication would be very very important.Please let me know!
Alessio
-
Also Alessio,
Agreed with your scenario - we are prioritizing a improvement to deal with that scenario for you.
Also that maximum # of servers is a limit that we can control per-app - so we can bump that up.
Paul.
-
Hi @Paul-Winterhalder, any chance to have new developments regarding reconnection in the room?
-
Hi @Alessio-Falsetti - checking with the devs.
I believe we have a short-term Relay Server patch that makes reconnecting generally more reliable -- but also a change for 5.2 that can allow reconnecting across sessions... (that will be an option for the dev to enable).
5.2 is currently targeting mid-to-late February for release.
-
Great! Happy to hear that!
-
Ciao @Paul-Winterhalder, @Greg-Moulds,
I have updated BC to 5.2, so I can implement the rejoin in the room. But it's not clear to me how to implement it. The only information I found is in the release notes where it only says this:Reconnects - Relay Servers now better handling reconnect scenarios. There is also an option to allow reconnects even if the userβs session has changed ("ALLOW_REJOIN_BY_PROFILE_ID": "true").
How does it work?
Thanks!
-
Hey @Alessio-Falsetti . In order to enable that feature, you need to update the "Custom Environment" settings for the appropriate "My Servers" definition:
-
Hi @Greg-Moulds ,
ok, I've updated the custom environment of my server, and now? If I try to rejoin the room, I receive alway this error:
"status":403,"reason_code":90300,"status_message":"Server Closed Connection","severity":"ERROR"}.I'm using:
RelayService.Connect(RelayConnectionType.TCP, connectionOptions, null, failureCallback);What should I do?
Thanks! -
Hmm... Let me poke around.
-
So a question for you... are you able to connect initially and it's failing on the reconnect? Or are you failing to connect at all?
-
I'm assuming from your statement "if I try to rejoin the room" that you've connected successfully initially.
-
Yes, works well first time.
-
However, reconnection doesn't work.
-
Ok thanks @Alessio-Falsetti . We're still looking into it so I'll let you know when we have an update.
-
@Alessio-Falsetti Next question... what are your "Disband on start" and "Allow join in progress" settings for this lobby type?
-
Ok @Alessio-Falsetti ,
I'm 99% sure I know what's going wrong. Correct me if I'm wrong but your lobby type configuration has both "Disband on start" and "Allow join in progress" set to true.
This was a bug in our portal that existed up until the recent 5.2 release. Now, you cannot set both those values to true. The portal (neither portal-X nor the legacy portal) will not allow you to do this.
All that said, your lobby type configuration was obviously created before we fixed this so your lobby configuration is in a bad state and you need to choose one or the other.
I don't know enough about your use-case to say which you should choose but if you want to ask for some guidance, let us know and we can take a closer look at your requirements and figure it out.
For now, you can just do a quick test by turning one of "Disband on start" or "Allow join in progress" off and re-run your test.
Let us know how it turns out!