Question about Bridge example

Dear Sirs,
I have a question about Bridge example. Looking at the example of SKETCH BUILDER we see:

BLYNK_CONNECTED() {
  bridge1.setAuthToken("OtherAuthToken"); // Place the AuthToken of the second hardware here
}

Why the command: bridge1.setAuthToken(“OtherAuthToken”); is placed in BLYNK_CONNECTED() function and NOT at void setup() ???

Thanks

Since it does require a Blynk connection in-order to work, that is probably the best way to activate it.

Sure it does but this is the initializer… Why to reactivate each time that BLYNK_CONNECTED() ???
ANY ANSWER from Blynk architects?

Thanks

Because this is session credentials and the session is not persistent. So auth will be active only while connection is active. After connection dropped you have to provide auth again.
Initial idea was to implement bridge within widget, so that never would be an issue, but we never get there.

1 Like

That is the explanation that I looked for. Thanks!

Yup :stuck_out_tongue_winking_eye:

1 Like