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.
split transport from main Firebase object #70
Open
Description
In order to be portable across multiple IoT platform we should split the transport from the main Firebase*
class.
The core of the library would be a set of portable class for holding the db url, the credentials and building method payload.
And then there would be transport class for each platform:
- FirebaseArduinoESP8266
- FirebaseCurl
- FirebasePhoton
- FirebaseArduinoSerialAT
A main for the curl platform could look like this:
#include "Firebase.h"
#include "FirebaseCurlTransport.h"
int main() {
Firebase firebase("example.firebaseio.com", "secret");
FirebaseGet getLogs = firebase.get("/logs");
FirebaseCurlTransport transport;
transport.write(getLogs);
std::string result;
transport.read(&result);
std::cout << result << std::endl;
}
A main for the Arduino platform could loop like this:
#include "Firebase.h"
#include "FirebaseArduinoESP8266Transport.h"
FirebaseCurlTransport transport;
Firebase firebase("example.firebaseio.com", "secret");
void setup() {
// optional warm up connect
transport.connect(firebase);
}
void loop() {
transport.write(firebase.get("/logs"));
String result;
transport.read(&result);
}