0

How can I get the next child after user without any triggers?

 FirebaseResponse resp2 = await client.GetTaskAsync("user/");
 Data obj2 = resp2.ResultAs<Data>();

How to get the data of Amiel,Ernesto,Jonneth

KENdi
  • 7,576
  • 2
  • 16
  • 31

1 Answers1

0

Assuming you are using Fire#, you can listen to child_added events to retrieve data from the server. This will work it's way through your database until you tell it to stop.

EventStreamResponse response = await client.OnAsync("user", (sender, args) => {
       System.Console.WriteLine(args.Path);
       System.Console.WriteLine(args.Data);
});

// Call dispose to stop listening for events
// response.Dispose();
samthecodingman
  • 23,122
  • 4
  • 30
  • 54
  • I am using fire# but there is no EventStreamResponse. – Ernesto Arcillas Apr 15 '19 at 03:21
  • can't also use the client.OnAsync – Ernesto Arcillas Apr 15 '19 at 03:30
  • This is taken directly from the [Fire# docs](https://github.com/ziyasal/FireSharp#listen-streaming-from-the-rest-api) and `EventStreamResponse` is part of Fire# at `FireSharp.Core.Response.EventStreamResponse`. Regarding "can't use client.OnAsync" - why not? – samthecodingman Apr 15 '19 at 07:29
  • sorry my fire# is out dated. still got a problem in sender – Ernesto Arcillas Apr 16 '19 at 01:18
  • try { EventStreamResponse response = await client.OnAsync("account", (SendKeys, args, context) => { System.Console.WriteLine(args.Path); System.Console.WriteLine(args.Data); }); } catch(Exception ex) { MessageBox.Show(ex.Message); } – Ernesto Arcillas Apr 16 '19 at 01:30
  • That's a null error. Follow these [steps here](https://stackoverflow.com/a/4660186) to help figure it out. If I were to take a stab in the dark, I'd say you haven't [initialized the `client` object](https://github.com/ziyasal/FireSharp#how-can-i-configure-firesharp) properly. Solving the issue beyond this point will be up to you. – samthecodingman Apr 16 '19 at 02:44