This repository was archived by the owner on Mar 17, 2025. It is now read-only.
This repository was archived by the owner on Mar 17, 2025. It is now read-only.
Simple streaming API proposal #159
Open
Description
I'd like to propose a simple way to handle streaming, instead of having explicit stream methods, it could just an option of begin()
, a different variant beginStream
or even a FirebaseStream
global object.
stream an int value
void setup() {
FirebaseStream.begin("example.firebaseio.com", "token_or_secret");
}
void loop() {
if (FirebaseStream.available()) {
Serial.print("value changed:");
Serial.println(FirebaseStream.getInt('/path/to/int'));
}
}
stream a more complex object
void setup() {
FirebaseStream.begin("example.firebaseio.com", "token_or_secret");
}
void loop() {
if (FirebaseStream.available()) {
FirebaseObject obj = FirebaseStream.get('/path/to/object')
Serial.print("value changed:");
Serial.println(obj.getFloat("/subpath/to/float););
}
}
This could also mix well with #160 to stream from a specific path.
void setup() {
FirebaseStream.begin("example.firebaseio.com", "token_or_secret", '/path/to/object');
}
void loop() {
if (FirebaseStream.available()) {
Serial.print("value changed:");
Serial.println(FirebaseStream.getFloat("/subpath/to/float););
}
}