mobizt / Firebase-ESP32

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

multipath stream + set data #178

Closed ayyysh04 closed 3 years ago

ayyysh04 commented 3 years ago

I am doing a project of a switch and led where i have to update the on /off data sent from arduino to firebase and firebase to arduino. I am using multipath stream and setString to receive and update data. Receiving is fine but when i update data using setstring the data gets updated in firebase but multipath stream detects it again and update the data again .This make the on and off commands slow.

Is there any function which allow us to set/update data without getting deteced by multipath stream

mobizt commented 3 years ago

You should avoid the recursive like operation.

It's not library issue unless your data flow problem.

Don't use any stream update data to send something to update the node under the parent path.

mobizt commented 3 years ago
Firebase.setStringAsync(firebaseData1, "firebaseData1","0"); 

You use the same Firebase Data object, firebaseData1 for stream with callback and other CRUD (create/read/update/delete) operations which is not recommended and you will not see usage like this in the examples.

You can use only one Firebase Data object for stream read operation and CRUD, not stream callback like this.

Stream connection session need to be keep open after request sent, if you interrupt it by using the same Firebase Data object that holds the TCP client to connect to other request in non-stream mode, the current stream connection will be stop to open new connection of non-stream request.

ayyysh04 commented 3 years ago

thanks it worked