Task StartSessionInternal() { return(Task.Run(async() => { if (client != null) { await Disconnect(); } connected = false; sendTask = null; Debug.Log("Connecting to SignalNow"); try { ConnectionStatusChanged?.Invoke(ConnectionStatus.Connecting); if (await client.Connect(userName, Guid.NewGuid().ToString(), company, team, authKey, graphName)) { Debug.Log($"Connected to {client.ServerAddress} as {client.Me.UserId}."); lastSendTime = DateTime.UtcNow; connected = true; } else { Debug.LogError($"Could't connect to SignalNow"); } } catch (Exception ex) { Debug.LogError($"!!!!!!!!!!!!!!!!!!!!!!! Exception when connecting to SignalNow. {ex.GetType().Name}: {ex.Message}\n{ex.StackTrace}"); if (ex.InnerException != null) { Debug.LogError($"=== INNER EXCEPTION!!! ===\n{ex.InnerException.GetType().Name}: {ex.InnerException.Message}\n{ex.InnerException.StackTrace}"); } } })); }