mobizt/Firebase-ESP8266

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

pelizz opened this issue · 6 comments

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

It's impossible.

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

You should post your code and database structure snapshot.

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.

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.