3 ms·
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 uploade
by Kiro 10y ago
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.
- mbleigh 10y agoYou 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.
- inlined 10y agoWhen 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
- inlined 10y agohttps://youtu.be/GNR9El3XWYo https://youtu.be/GNR9El3XWYo
- Kiro 10y agoOh, I completely missed that there were HTTP triggers as well. Thank you!
- phpencil 10y agoThere 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 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 https://firebase.google.com/docs/functions/http-events