dkrprasetya / simple-firebase-unity

Firebase Realtime-Database's REST API Wrapper for Unity in C#
143 stars 40 forks source link

Can't get Push working #2

Closed madvas closed 8 years ago

madvas commented 8 years ago

Hi

First of all thanks for a great library.

I'm using this with unity. When I run your sample scene, but with URL to my firebase DB, firebase.Child("Messages").Push("{ name: \"dikra\", message: \"awesome!\"}", true); doesn't make any changes to database. SetValue or GetValue works fine.

Thank you

madvas commented 8 years ago

ok I figured out StartCoroutine(Firebase.ToCoroutine(firebase.Push, dict1)); writes to DB

dkrprasetya commented 8 years ago

Hi, madvas.

Thanks for using my work! Hope it could helps your awesome project.

So, is it working fine now? How could I help?

madvas commented 8 years ago

Maybe you should test in your Sample scene if firebase.Child("Messages").Push("{ name: \"dikra\", message: \"awesome!\"}", true); is making changes to your database. If not, either find the problem, or replace it with StartCoroutine(Firebase.ToCoroutine(firebase.Push, dict1)); format in your docs.

Thanks

dkrprasetya commented 8 years ago

Found your problem!

The JSON parser that I am using are unable to parse your JSON string: firebase.Child("Messages").Push("{ name: \"dikra\", message: \"awesome!\"}", true);

They tried to parse it as an object of Dictionary<string, object>, but they couldn't detect the key as a string object because they are expecting a string to be surrounded by quote (") marks.

Of course you can make it parsable by setting the keys in the JSON as a string by yourself by surrounding them with quote (") marks, such as: firebase.Child("Messages").Push("{ \"name\": \"dikra\", \"message\": \"awesome!\"}", true);

Is it working for you?

Edit: Ah I just realised it a moment ago, it is from the sample script isn't it? My Bad! I'll update it right away 👍

Thanks for the report madvas!

madvas commented 8 years ago

Thanks a lot, this works now ;)

dkrprasetya commented 8 years ago

Awesome!

Don't forget to review and rate 5 stars :D