This is more of a design question rather than a coding question. I am new to Firebase and cloud development so please bear with me....
I am using the Firebase real time database in my application. I have a requirement to invoke / trigger a data scraping module (implemented in CasperJS) based on a user interaction in the client web app. The data scraper will do its thing and then push values into firebase RTDB. The client app has a listener function (listening for these data scraped updates) which will get called when the scraper makes any updates to a specific node in the database tree.
In my prototype, I attempted to resolve this using Google cloud functions. The web client can write to a database location which generates a database event trigger to invoke a cloud function. My three part question is:
1) How is the compute environment in which the cloud functions are deployed controlled? CasperJS uses a different JavaScript engine (not V8), and hence cannot be simply called from inside my cloud function event handler which is implemented in NodeJS (and uses V8).
2) Is using Cloud Functions the best way to invoke my backend business logic for my application? Could I do this by utilizing say the Google App Engine (or something else) to create an instance (and an environment) in which the CasperJS script will run ? If so how would the app engine (business logic) module be called from the firebase client app? Or from the cloud function event handler?
3) And after it does its thing, how will the scraped data get pushed into Firebase?
In all my web searches and reviewing Firebase docs, I was unable to find a clear explanation...so thanks in advance for clarifying this.
via Pankaj
No comments:
Post a Comment