News for hackers. Stuff that matters.
Re:Introducing Cloud Functions for Firebase by Kiro on Thursday March 09, 2017 @02:53PM (#13832795)
I don't really understand how to use this to build a real backend. Everything seem to be revolving around reactions (new thing happening in the DB, file uploaded etc) but isn't the more common use case that you actually want to call the function directly?

I'm building a simple React Native/Expo app where I want users to join random chat rooms so I obviously need some logic to delegate this process. Is Firebase/Cloud Functions something I can consider?

My first thought was "oh, maybe I can let my app call the function directly to add the user to a random chat room" but I don't see how that is possible.

Re:Introducing Cloud Functions for Firebase by phpencil on Thursday March 09, 2017 @03:07PM (#13832974)
There are a few ways! For example when the user signs in, you could assign them a random chat room https://firebase.google.com/docs/functions/auth-events lets you trigger on initial sign in.

You can also hook up to regular HTTP triggers, and make it like an API call: https://firebase.google.com/docs/functions/http-events

Re:Introducing Cloud Functions for Firebase by mbleigh on Thursday March 09, 2017 @02:56PM (#13832842)
You can definitely do this! There are two ways that readily come to mind:

1. Use the Realtime Database as a communication channel to trigger a Cloud Function that then sets up the thing you need.

2. Create an HTTPS function and call it directly from your app, then do the work you need.

Re:Introducing Cloud Functions for Firebase by inlined on Thursday March 09, 2017 @03:05PM (#13832940)
When it hits YouTube, check out our talk "Cloud Functions and Firebase". We have a much more complex chat room example than has been possible in the past
Re:Introducing Cloud Functions for Firebase by inlined on Friday March 10, 2017 @12:37AM (#13836638)
Re:Introducing Cloud Functions for Firebase by Kiro on Thursday March 09, 2017 @03:06PM (#13832959)
Oh, I completely missed that there were HTTP triggers as well. Thank you!