Adding in a special case for a client to detect the host leaving the lobby. Verified that we don't need to do additional cleanup. Verified that the host disconnecting from Relay will cause the lobby to disconnect after 10s as expected; this supplies an error popup with the exception, which is fine?
onComplete?.Invoke(response);// FUTURE: Consider passing in the exception code here (and elsewhere) to, e.g., specifically handle a 404 indicating a Relay auto-disconnect.
// If the host suddenly leaves, the Lobby service will automatically handle disconnects after about 30s, but we can try to do a disconnect sooner if we detect it.
if(!m_localUser.IsHost)
{
foreach(varlobbyUserinm_localLobby.LobbyUsers)
{
if(lobbyUser.Value.IsHost)
return;
}
Locator.Get.Messenger.OnReceiveMessage(MessageType.DisplayErrorPopup,"Host left the lobby! Disconnecting...");
/// Disconnect from Relay, usually while leaving the lobby. (You can also call this elsewhere to see how Lobby will detect a Relay disconnect automatically.)