/// <summary> /// Starts watching the GameServer updates in the background in it's own task. /// On update, it fires the GameServerUpdate event. /// </summary> private async Task BeginInternalWatch() { //Begin WatchGameServer in the background for the provided callback. try { using (watchStreamingCall = client.WatchGameServer(new Empty(), cancellationToken: ctoken)) { var reader = watchStreamingCall.ResponseStream; while (await reader.MoveNext(ctoken)) { GameServerUpdated?.Invoke(reader.Current); } } } catch (RpcException ex) { LogError(ex, "Unable to subscribe to GameServer events."); throw; } }
/// <summary> /// Starts watching the GameServer updates in the background in it's own task. /// On update, it fires the GameServerUpdate event. /// </summary> private async Task BeginInternalWatch() { //Begin WatchGameServer in the background for the provided callback. try { using (watchStreamingCall = client.WatchGameServer(new Empty(), cancellationToken: ctoken)) { var reader = watchStreamingCall.ResponseStream; while (await reader.MoveNext(ctoken)) { GameServerUpdated?.Invoke(reader.Current); } } } catch (RpcException ex) { Console.Error.WriteLine(ex.Message); throw ex; } }