Skip to content

Commit

Permalink
Fix minor issue and update the Realtime database simple examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Jun 9, 2024
1 parent 6833aab commit 881d382
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* This example is for new users which are familiar with other legacy Firebase libraries.
*
* The example shows how to set, push and get the values to/from Realtime database.
*
* All functions used in this example are blocking (sync) functions.
*
* This example will not use any authentication method included database secret.
*
Expand Down Expand Up @@ -79,14 +81,9 @@ void setup()
// Set your database URL
Database.url(DATABASE_URL);

// Set the operating result for the the following blocking (sync) functions.
// The result will keep in the async result object we set to the client.
// In sync functions, we have to set the operating result for the client that works with the function.
client.setAsyncResult(result);

// The following are blocking operations which the result will store in the result object we set above.

// In the another Stream examples, we will use the non-blocking (async) functions to allow the realtime incoming data.

// Set, push and get integer value

Serial.print("Set int... ");
Expand Down
11 changes: 4 additions & 7 deletions examples/RealtimeDatabase/Simple/SimpleNoAuth/SimpleNoAuth.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* The example shows how to set, push and get the values to/from Realtime database.
*
* All functions used in this example are blocking (sync) functions.
*
* This example will use the database secret for priviledge Realtime database access which does not need
* to change the security rules or it can access Realtime database no matter what the security rules are set.
*
Expand Down Expand Up @@ -86,14 +88,9 @@ void setup()
// Set your database URL
Database.url(DATABASE_URL);

// Set the operating result for the the following blocking (sync) functions.
// The result will keep in the async result object we set to the client.
// In sync functions, we have to set the operating result for the client that works with the function.
client.setAsyncResult(result);

// The following are blocking operations which the result will store in the result object we set above.

// In the another Stream examples, we will use the non-blocking (async) functions to allow the realtime incoming data.

// Set, push and get integer value

Serial.print("Set int... ");
Expand Down Expand Up @@ -249,7 +246,7 @@ void setup()

void loop()
{
// We don't need to poll the async task using Database.loop(); as in the Stream examples because
// We don't need to poll the async task using Database.loop(); as in the Stream examples because
// only blocking (sync) functions were used in this example.

// We don't have to poll authentication handler task using app.loop() as seen in other examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* The example shows how to listen the data changes in your Firebase Realtime database
* while the database was set periodically.
*
* All functions used in this example are non-blocking (async) functions.
*
* This example will use the database secret for priviledge Realtime database access which does not need
* to change the security rules or it can access Realtime database no matter what the security rules are set.
Expand Down Expand Up @@ -132,7 +134,7 @@ void setup()

// Initiate the Stream connection to listen the data changes.
// This function can be called once.
// The Stream was connected using async get function (non-blocking) which the result was assign to the function.
// The Stream was connected using async get function (non-blocking) which the result will assign to the function in this case.
Database.get(client1, "/test/stream", result1, true /* this option is for Stream connection */);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* The example shows how to listen the data changes in your Firebase Realtime database
* while the database was set periodically.
*
* All functions used in this example are non-blocking (async) functions.
*
* This example will not use any authentication method included database secret.
*
Expand Down Expand Up @@ -142,7 +144,7 @@ void setup()

// Initiate the Stream connection to listen the data changes.
// This function can be called once.
// The Stream was connected using async get function (non-blocking) which the result was assign to the function.
// The Stream was connected using async get function (non-blocking) which the result will assign to the function in this case.
Database.get(client1, "/test/stream", result1, true /* this option is for Stream connection */);
}

Expand Down

0 comments on commit 881d382

Please sign in to comment.