Title: Adding stream listeners to sniff change in child by rizasif · Pull Request #50 · firebase/firebase-admin-python · GitHub
Open Graph Title: Adding stream listeners to sniff change in child by rizasif · Pull Request #50 · firebase/firebase-admin-python
X Title: Adding stream listeners to sniff change in child by rizasif · Pull Request #50 · firebase/firebase-admin-python
Description: Hello, I noticed that there (according to my best knowledge) hasn't been a stream listener implemented in the project. Which has a sole responsibility to fire up a callback function (https://firebase.google.com/docs/reference/rest/database/#callback) when any change to a firebase node is occurred. This is essential for developers who want to perform an action when a change to database is observed. The changes I proposed are inspired by PyRebase (https://github.com/thisbejim/Pyrebase). I have implemented a SSEClient which uses python request library to listen for changes. These changes have been tested using a simulation of 100 users, performing read and write operations. The results, so far, are promising with 0% failure rate. I have written a test code for you as well. The following adds a new child node to the already available parent "users". Now, if you visit the firebase console and delete this new child node, then the "call_function" will fire up. Similar, case can be observed by updating, adding or deleting in the child of "users" node through the console. import firebase_admin from firebase_admin import credentials from firebase_admin import db # Fetch the service account key JSON file contents cred = credentials.Certificate("PATH_TO_JSON_FILE") # Initialize the app with a service account, granting admin privileges firebase_admin.initialize_app(cred, {"databaseURL": "DATABASE_URL"}) root = db.reference() print(root.get()) new_user = root.child("users").push({"name": "lila Annen", "age": 19}) ref = root.child("users") print(ref.get()) def call_function(message): print( message["event"]) print(message["path"]) my_stream_question_requested = db.reference("users").stream(call_function, stream_id="new stream") Hope to hear from you soon, thanks!
Open Graph Description: Hello, I noticed that there (according to my best knowledge) hasn't been a stream listener implemented in the project. Which has a sole responsibility to fire up a callback function (https://fi...
X Description: Hello, I noticed that there (according to my best knowledge) hasn't been a stream listener implemented in the project. Which has a sole responsibility to fire up a callback function (https:...
Opengraph URL: https://github.com/firebase/firebase-admin-python/pull/50
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:20ef1117-5746-7e8e-530c-e3080256b982 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | E34A:128FE7:24AEA27:2EC269B:6991117E |
| html-safe-nonce | 09a11c057f23f9fd90bc558b7b1b1b9d5bbdce5ebf10cf963be9e0dabaa70d39 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzRBOjEyOEZFNzoyNEFFQTI3OjJFQzI2OUI6Njk5MTExN0UiLCJ2aXNpdG9yX2lkIjoiMjI0MTIzMzkwODE0NTM5NDA0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b654877d60b9c3a6bf551f070c4526136e5cf69d9c91c6598d44db1bdb33f960 |
| hovercard-subject-tag | pull_request:131081597 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/firebase/firebase-admin-python/pull/50/checks |
| twitter:image | https://avatars.githubusercontent.com/u/8410351?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/8410351?s=400&v=4 |
| og:image:alt | Hello, I noticed that there (according to my best knowledge) hasn't been a stream listener implemented in the project. Which has a sole responsibility to fire up a callback function (https://fi... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/firebase/firebase-admin-python git https://github.com/firebase/firebase-admin-python.git |
| octolytics-dimension-user_id | 1335026 |
| octolytics-dimension-user_login | firebase |
| octolytics-dimension-repository_id | 84979152 |
| octolytics-dimension-repository_nwo | firebase/firebase-admin-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 84979152 |
| octolytics-dimension-repository_network_root_nwo | firebase/firebase-admin-python |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width