Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client doesn't reconnect after lost connection is restored #23

Closed
markom84 opened this issue Dec 25, 2019 · 2 comments
Closed

Client doesn't reconnect after lost connection is restored #23

markom84 opened this issue Dec 25, 2019 · 2 comments

Comments

@markom84
Copy link

I'm using private blynk server and python libs on Raspberry Pi.
Problem is that once network connection to the server is interrupted, so that heartbeat is missed, even after network connectivity is restored client doesn't return online and only way to restore it is to restart python script.
Steps to reproduce:
Setup private blynk server (same thing happens on Blynk Cloud server).
Use example script with logging.
After connection to server is established, interrupt somehow connectivity to the server (with firewall rule or by turning off router for 10 seconds).
Result is following:

Dec 25 13:03:46 raspberrypi python[21730]: 2019-12-25 13:03:46,397 [INFO]  Connected to blynk server
Dec 25 13:03:46 raspberrypi python[21730]: 2019-12-25 13:03:46,398 [INFO]  Authenticating device...
Dec 25 13:03:46 raspberrypi python[21730]: 2019-12-25 13:03:46,403 [INFO]  Access granted
Dec 25 13:03:46 raspberrypi python[21730]: 2019-12-25 13:03:46,406 [INFO]  Heartbeat = 10 sec. MaxCmdBuffer = 1024 bytes
Dec 25 13:03:46 raspberrypi python[21730]: 2019-12-25 13:03:46,407 [INFO]  Registered events: ['write v19', 'write v18', 'write v11', 'write v10', 'write v13', 'write v12', 'writ
Dec 25 13:03:56 raspberrypi python[21730]: 2019-12-25 13:03:56,442 [INFO]  Heartbeat time: 1577275436441
Dec 25 13:03:56 raspberrypi python[21730]: 2019-12-25 13:03:56,447 [INFO]  Response status: 200
Dec 25 13:04:06 raspberrypi python[21730]: 2019-12-25 13:04:06,488 [INFO]  Heartbeat time: 1577275446488
Dec 25 13:04:06 raspberrypi python[21730]: 2019-12-25 13:04:06,492 [INFO]  Response status: 200
Dec 25 13:04:16 raspberrypi python[21730]: 2019-12-25 13:04:16,529 [INFO]  Heartbeat time: 1577275456528
Dec 25 13:04:26 raspberrypi python[21730]: 2019-12-25 13:04:26,566 [INFO]  Heartbeat time: 1577275466566
Dec 25 13:04:36 raspberrypi python[21730]: 2019-12-25 13:04:36,582 [INFO]  Heartbeat time: 1577275476582
Dec 25 13:04:46 raspberrypi python[21730]: 2019-12-25 13:04:46,587 [INFO]  Heartbeat time: 1577275486587
Dec 25 13:04:56 raspberrypi python[21730]: 2019-12-25 13:04:56,591 [INFO]  Heartbeat time: 1577275496591
Dec 25 13:05:06 raspberrypi python[21730]: 2019-12-25 13:05:06,595 [INFO]  Heartbeat time: 1577275506595
Dec 25 13:05:16 raspberrypi python[21730]: 2019-12-25 13:05:16,599 [INFO]  Heartbeat time: 1577275516599
Dec 25 13:05:26 raspberrypi python[21730]: 2019-12-25 13:05:26,603 [INFO]  Heartbeat time: 1577275526603
Dec 25 13:05:36 raspberrypi python[21730]: 2019-12-25 13:05:36,607 [INFO]  Heartbeat time: 1577275536607
Dec 25 13:05:46 raspberrypi python[21730]: 2019-12-25 13:05:46,611 [INFO]  Heartbeat time: 1577275546611
Dec 25 13:05:56 raspberrypi python[21730]: 2019-12-25 13:05:56,615 [INFO]  Heartbeat time: 1577275556615
Dec 25 13:06:06 raspberrypi python[21730]: 2019-12-25 13:06:06,619 [INFO]  Heartbeat time: 1577275566619
Dec 25 13:06:16 raspberrypi python[21730]: 2019-12-25 13:06:16,623 [INFO]  Heartbeat time: 1577275576623
Dec 25 13:06:26 raspberrypi python[21730]: 2019-12-25 13:06:26,627 [INFO]  Heartbeat time: 1577275586627

As you can see, there is no any response from server (even though connection was interrupted only for short while).

In my opinion it should be detected that there is no response and reconnecting attempt should be made.

Anyway, if there is no way to fix this in library, is there a way to fix it in my python script?

@antohaUa
Copy link
Collaborator

Hi markom84!
Do you reproduce this with latest library version(version = '0.2.6') ?
As i remember such issue was fixed some time ago. Please see details #18

If you version under 0.2.6 ( you can get it just looking into library code header) please update it to latest version from github.

If issue reproducible on latest - please send me script code that you are running. Will try to investigate it.

Good luck!

@markom84
Copy link
Author

Hi, I can confirm that issue doesn't happen on 0.2.6, thanks for helping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants