I'm new to accessing Firebase from my backend. My question is where I should instantiate my listeners? If I do it when one of my controller methods are called, then I loose control of the thread that is instantiated when the listener is added to the database reference. I want to keep my code as stateless as possible, so having and boolean hasAddedFirebaseListeners
is something I would like to avoid.
Any ideas?