diff --git a/examples/DataChangesListener/Callback/Callback.ino b/examples/DataChangesListener/Callback/Callback.ino index 2fa5beb4..3eb248bf 100644 --- a/examples/DataChangesListener/Callback/Callback.ino +++ b/examples/DataChangesListener/Callback/Callback.ino @@ -157,6 +157,8 @@ void setup() // You can use TCP KeepAlive For more reliable stream operation and tracking the server connection status, please read this for detail. // https://github.com/mobizt/Firebase-ESP8266#enable-tcp-keepalive-for-reliable-http-streaming + // You can use keepAlive in ESP8266 core version newer than v3.1.2. + // Or you can use git version (v3.1.2) https://github.com/esp8266/Arduino // stream.keepAlive(5, 5, 1); if (!Firebase.beginStream(stream, "/test/stream/data")) @@ -215,4 +217,10 @@ void loop() dataChanged = false; // When stream data is available, do anything here... } + + // After calling stream.keepAlive, now we can track the server connecting status + if (!stream.httpConnected()) + { + // Server was disconnected! + } } diff --git a/examples/DataChangesListener/MultiPath/MultiPath.ino b/examples/DataChangesListener/MultiPath/MultiPath.ino index a7e4cb85..af71aef7 100644 --- a/examples/DataChangesListener/MultiPath/MultiPath.ino +++ b/examples/DataChangesListener/MultiPath/MultiPath.ino @@ -165,6 +165,8 @@ void setup() // You can use TCP KeepAlive For more reliable stream operation and tracking the server connection status, please read this for detail. // https://github.com/mobizt/Firebase-ESP8266#enable-tcp-keepalive-for-reliable-http-streaming + // You can use keepAlive in ESP8266 core version newer than v3.1.2. + // Or you can use git version (v3.1.2) https://github.com/esp8266/Arduino // stream.keepAlive(5, 5, 1); // The data under the node being stream (parent path) should keep small @@ -241,4 +243,10 @@ void loop() dataChanged = false; // When stream data is available, do anything here... } + + // After calling stream.keepAlive, now we can track the server connecting status + if (!stream.httpConnected()) + { + // Server was disconnected! + } } diff --git a/examples/DataChangesListener/NoCallback/NoCallback.ino b/examples/DataChangesListener/NoCallback/NoCallback.ino index 57ba19a5..0b9294ea 100644 --- a/examples/DataChangesListener/NoCallback/NoCallback.ino +++ b/examples/DataChangesListener/NoCallback/NoCallback.ino @@ -118,6 +118,8 @@ void setup() // You can use TCP KeepAlive For more reliable stream operation and tracking the server connection status, please read this for detail. // https://github.com/mobizt/Firebase-ESP8266#enable-tcp-keepalive-for-reliable-http-streaming + // You can use keepAlive in ESP8266 core version newer than v3.1.2. + // Or you can use git version (v3.1.2) https://github.com/esp8266/Arduino // stream.keepAlive(5, 5, 1); if (!Firebase.beginStream(stream, "/test/stream/data")) @@ -203,4 +205,10 @@ void loop() Serial.printf("Free Heap, %d\n", (int)ESP.getFreeHeap()); Serial.println(); } + + // After calling stream.keepAlive, now we can track the server connecting status + if (!stream.httpConnected()) + { + // Server was disconnected! + } } \ No newline at end of file diff --git a/examples/DataChangesListener/SingleDataObject/SingleDataObject.ino b/examples/DataChangesListener/SingleDataObject/SingleDataObject.ino index 7ab71383..e92a668e 100644 --- a/examples/DataChangesListener/SingleDataObject/SingleDataObject.ino +++ b/examples/DataChangesListener/SingleDataObject/SingleDataObject.ino @@ -123,6 +123,8 @@ void setup() // You can use TCP KeepAlive For more reliable stream operation and tracking the server connection status, please read this for detail. // https://github.com/mobizt/Firebase-ESP8266#enable-tcp-keepalive-for-reliable-http-streaming + // You can use keepAlive in ESP8266 core version newer than v3.1.2. + // Or you can use git version (v3.1.2) https://github.com/esp8266/Arduino // fbdo.keepAlive(5, 5, 1); // The data under the node being stream (parent path) should keep small @@ -169,4 +171,10 @@ void loop() fbdo.stringData().c_str()); } } + + // After calling stream.keepAlive, now we can track the server connecting status + if (!fbdo.httpConnected()) + { + // Server was disconnected! + } } \ No newline at end of file