Stream not working when using ServiceAuth since version 2.0.0 #234
Replies: 3 comments 1 reply
-
If you noticed that why the library version changed its major version from 1 to 2, it should be something totally changes. The big reliability improvement in the core which reduces the code complexity in v2.0.0. The library examples are changed too. Please follow the new examples. |
Beta Was this translation helpful? Give feedback.
-
Ok I will check it and update the result. |
Beta Was this translation helpful? Give feedback.
-
Now you can update to v2.0.1 that fixed this issue. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am experiencing an issue with the stream not working when using ServiceAuth since version 2.0.0.
(I am using ServiceAuth because I am implementing FCM, also).
I used your example sketch of Stream with ServiceAuth, as shown below:
#include <Arduino.h>
#include <FirebaseClient.h>
#include "ExampleFunctions.h" // Provides the functions used in the examples.
#define WIFI_SSID ""
#define WIFI_PASSWORD ""
#define DATABASE_URL ""
#define FIREBASE_PROJECT_ID ""
#define FIREBASE_CLIENT_EMAIL ""
const char PRIVATE_KEY[] PROGMEM = "";
void processData(AsyncResult &aResult);
SSL_CLIENT ssl_client, stream_ssl_client;
using AsyncClient = AsyncClientClass;
AsyncClient aClient(ssl_client), streamClient(stream_ssl_client);
ServiceAuth sa_auth(FIREBASE_CLIENT_EMAIL, FIREBASE_PROJECT_ID, PRIVATE_KEY, 3000 /* expire period in seconds (<= 3600) */);
FirebaseApp app;
RealtimeDatabase Database;
AsyncResult streamResult;
unsigned long ms = 0;
void setup()
{
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
}
void loop()
{
// To maintain the authentication and async tasks
app.loop();
}
void processData(AsyncResult &aResult)
{
// Exits when no result available when calling from the loop.
if (!aResult.isResult())
return;
#if defined(ESP32) || defined(ESP8266)
Firebase.printf("Free Heap: %d\n", ESP.getFreeHeap());
#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)
Firebase.printf("Free Heap: %d\n", rp2040.getFreeHeap());
#endif
}
}
And I get the following results:
Connecting to Wi-Fi.........
Connected with IP: 192.168.18.80
Firebase Client v2.0.0
Initializing app...
Getting time from NTP server... failed, retry... success
Event task: 🔐 authTask, msg: initializing, code: 1
Event task: 🔐 authTask, msg: token signing, code: 6
Event task: 🔐 authTask, msg: authenticating, code: 7
Debug task: 🔐 authTask, msg: Connecting to server...
Event task: 🔐 authTask, msg: auth request sent, code: 8
Event task: 🔐 authTask, msg: auth response received, code: 9
Debug task: 🔐 authTask, msg: Terminating the server connection...
Event task: 🔐 authTask, msg: ready, code: 10
Debug task: streamTask, msg: Connecting to server...
Debug task: setTask, msg: Connecting to server...
task: setTask, payload: {"ms":20001,"rand":26155}
Free Heap: 91372
task: setTask, payload: {"ms":40002,"rand":19450}
Free Heap: 91456
task: setTask, payload: {"ms":60003,"rand":19753}
Free Heap: 91096
What am I doing wrong? Thank you very much in advance!
Beta Was this translation helpful? Give feedback.
All reactions