- Firebase Cloud Function이란?
Cloud Functions로 무엇을 할 수 있나요? | Firebase Documentation
Cloud Functions로 무엇을 할 수 있나요? | Firebase Documentation
의견 보내기 Cloud Functions로 무엇을 할 수 있나요? 개발자는 Cloud Functions를 사용하여 Firebase 및 Google Cloud 이벤트에 액세스하고 확장 가능한 컴퓨팅 성능을 사용하여 이러한 이벤트에 대한 응답으
firebase.google.com
DB의 trigger 개념과 유사.
해당 page에서는 cloud function의 기능을 다음과 같이 설명하고 있다.
- Notify users when something interesting happens.
- Perform database sanitization and maintenance.
- Execute intensive tasks in the cloud instead of in your app.
- Integrate with third-party services and APIs.
Get started with Cloud Firestore | Firebase Documentation
Cloud Firestore 시작하기 | Firebase Documentation
의견 보내기 Cloud Firestore 시작하기 이 빠른 시작에서는 Cloud Firestore를 설정하고 데이터를 추가한 후 Firebase Console에서 방금 추가한 데이터를 확인하는 방법을 볼 수 있습니다. Cloud Firestore 데이터
firebase.google.com
Tutorial 링크.
- Notification
https://firebase.google.com/codelabs/firebase-cloud-functions#0
Firebase용 Cloud Functions
이 코드랩에서는 Google Cloud Functions용 Firebase SDK를 사용하여 Chat 웹 앱을 개선하는 방법과 Cloud Functions를 사용하여 Chat 앱 사용자에게 알림을 보내는 방법을 알아봅니다.
firebase.google.com
이게 notification.
지원님한테 물어보니 push notification도 schedule function을 이용해야 한다고 한다. 그런데, 생각해보면 굳이 push notification을 사용하지 않아도 local notification으로도 implementation이 가능할 것 같다.
- Pub/sub schedule
https://firebase.google.com/docs/functions/schedule-functions
함수 예약 | Firebase Documentation
의견 보내기 함수 예약 지정된 시간에 함수를 실행하도록 예약하려면 functions.pubsub.schedule().onRun()을 사용하세요. 이 간편한 메서드는 Pub/Sub 주제를 만들고 Cloud Scheduler를 사용하여 원하는 일정에
firebase.google.com
굉장한 정보….
emulator에서는 확인할 수 없다고 한다.
우리가 지금 개발하고 있는 앱에서는 schedule function은 굳이 써지 않아도 되고 각 schedule function job 마다 0.1$씩 비용이 든다고 해서 local에서 date가 지났는지를 연산해보기로 했다. 또, routine이 종료되는 시점이 날짜 기준인지 명확하게 시간까지 따져야 하는지 확실하지 않다.
issue
- cloud function을 사용하려 할 때에 에러https://pjausovec.medium.com/firebase-emulators-error-timeout-port-8080-on-localhost-was-not-active-within-60000ms-356d7567969a
- Error: TIMEOUT: Port 8003 on localhost was not active within 60000ms
결론
일단, cloud function의 비용이 많이 들진 않아도 굳이 사용하지 않아도 되는 상황이라고 판단이 되어서 local에서 최대한 기능을 구현해보는 방향으로 해야 겠다.
결과물
GitHub - growbook91/CloudToyProj
GitHub - growbook91/CloudToyProj
Contribute to growbook91/CloudToyProj development by creating an account on GitHub.
github.com
'flutter' 카테고리의 다른 글
flutter에서 Inspector 사용하는 법 (1) | 2022.06.29 |
---|---|
특정화면에서 flutter를 실행하는 법 (0) | 2022.06.29 |
Firestore, android 연동 오류 (0) | 2022.06.27 |
Local Notification (0) | 2022.06.27 |