mobizt / Firebase-ESP8266

[DEPRECATED] 🔥 Firebase RTDB Arduino Library for ESP8266 and RP2040 Pico. The complete, fast, secured and reliable Firebase Arduino client library that supports CRUD (create, read, update, delete) and Stream operations.
MIT License
411 stars 111 forks source link

StreamAvailabe in readStream also writing on path other than that used in the beginStream #302

Closed pelizz closed 2 years ago

pelizz commented 2 years ago

Using ESP8266 with platformio in a Tasmota user driver: 1) I beginStream on a certain path for example /room/config : Firebase.beginStream(firebaseData, "/room/config") 2) I use readStream in loop: if (!Firebase.readStream(firebaseData)) {...} if (firebaseData.streamAvailable()) {..} 3) StreamAvailable is trigged when i write on this path -> OK But Stream available is trigged ALSO when i write on another path; for example /boilerConfig for example using Firebase.setJSON(firebaseData, "/boilerConfig", json1) In this case FirebaseData.dataPath().c_str() is equal to "/" and the data payload is the full tree at path "/room/config"

Using https://github.com/mobizt/Firebase-ESP8266#v3.8.2

mobizt commented 2 years ago

It's impossible.

mobizt commented 2 years ago

Your code may do something incorrectly or not properly.

You should separate to use FirebaseData object for stream from other functions.

Please see the examples for how to use it properly. https://github.com/mobizt/Firebase-ESP8266/blob/master/examples/DataChangesListener/Callback/Callback.ino https://github.com/mobizt/Firebase-ESP8266/blob/master/examples/DataChangesListener/NoCallback/NoCallback.ino

mobizt commented 2 years ago

You should post your code and database structure snapshot.

mobizt commented 2 years ago

Even you use the same FirebaseData objeect sharing between stream and other functions. https://github.com/mobizt/Firebase-ESP8266/tree/master/examples/DataChangesListener/SingleDataObject

Everything works and ok.

The library was intensively tested for many years and does not have this kind of issue.

pelizz commented 2 years ago

Your code may do something incorrectly or not properly.

You should separate to use FirebaseData object for stream from other functions.

Please see the examples for how to use it properly. https://github.com/mobizt/Firebase-ESP8266/blob/master/examples/DataChangesListener/Callback/Callback.ino https://github.com/mobizt/Firebase-ESP8266/blob/master/examples/DataChangesListener/NoCallback/NoCallback.ino

Sorry ...i used the same object for read and write. I will try with different objects. Thank you.

pelizz commented 2 years ago

Sorry...i used the same Firebase object for readStream and for setJSON. I will try .

Thank you. Maurizio

Il lun 14 feb 2022, 01:32 Suwatchai K. @.***> ha scritto:

Your code may do something incorrectly or not properly.

You should separate to use FirebaseData object for stream from other functions.

Please see the examples for how to use it properly.

https://github.com/mobizt/Firebase-ESP8266/blob/master/examples/DataChangesListener/Callback/Callback.ino

https://github.com/mobizt/Firebase-ESP8266/blob/master/examples/DataChangesListener/NoCallback/NoCallback.ino

— Reply to this email directly, view it on GitHub https://github.com/mobizt/Firebase-ESP8266/issues/302#issuecomment-1038496466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMA3GKVMTSJWDYG2CUY5YOLU3BER5ANCNFSM5OJVK6LA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>