Is there a way to localize my Firebase database?

I think the title of the question itself is explanatory, however the following details are more detailed

Background

I am developing a one-off game for Android using Firebase realtime database. The concept is very simple, all players are connected to the same room, which I create by going into the firebase database. Now each player attaches a child value listener to this node. Now I can update the game status in this node and everyone will get a real-time update.

Problem

During the development phase, I am still trying to structure this data in different ways and implement it in the android client. I don't work for any company or enterprise, so I have to use my own mobile internet (where internet data is expensive). Plus, many times I find myself in an area where there is no internet connection. This reduces the time spent testing any network testing.

Question

Can i simulate (or emulate) firebase database locally? So when it works fine, can I test it on a real network? Any ideas or hints regarding this would be helpful.

+3


source to share


1 answer


It sounds like you probably want to try firebase-server . It is basically a replacement real-time database server that can be run locally.

You need to edit your OS hosts file to make the 3-part domain name (eg localhost.firebaseio.test) allowed on localhost, due to some strange restrictions built into the Firebase client libraries. Some people have found a way around this by injecting an apology into the client library, but that didn't work for me; I think it only worked in the old version.



Note that this is NOT the officially recommended way to write unit tests; it was deemed better to completely wear out the Firebase client library. However, it can be quite useful for integration tests.

There is a useful topic here that covers some test questions.

+1


source







All Articles