blynk-library-python icon indicating copy to clipboard operation
blynk-library-python copied to clipboard

Socket Disconnects - Blynk offline

Open Judas2016 opened this issue 2 years ago • 4 comments

Hi,

I have been running the latest Blynk Python checkin from his repo and continue to see random disconnects. I have 2 separate apps that are making use of Blynk 2.0 and both show similar behavior. They randomly disconnect from the Blynk servers, they show as offline in the mobile application. The apps are running in Docker containers on RPI 4 devices, the containers are running without issue and the writes to the Blynk library are NOT failing, no exception thrown. I suspect the socket level connection is failing and the library may be in a "disconnected" state and "eating" the write requests. If the code issues a disconnect/connect method call the devices comes back online. I noticed in the Blynk library code there are a few places w/"todo" comments on handling disconnects.... so suspect this is known issue that's still open in the core library design. I'm using the latest code checked into this GIT - anyone have ideas on how to fix?

git+https://github.com/vshymanskyy/blynk-library-python@f84633c#egg=blynk-library-python

Judas2016 avatar Jul 12 '22 12:07 Judas2016

I'm having the same issue, any updates to this?

pjlfrost avatar Dec 08 '22 01:12 pjlfrost

the latest gist has a fix that addresses a lot of the problem. add exception logic to catch disconnected blynk objects, disconnect and reconnect them. Core comm to server is socket and it's sensitive to network disconnects. I changed to wired RPI4 vs. wireless which helped as well.

Judas2016 avatar Dec 08 '22 02:12 Judas2016

@Judas2016 the latest commit is on March 6th 2022, is this the one you're refering to?

pjlfrost avatar Dec 09 '22 00:12 pjlfrost

@Judas2016 the latest commit is on March 6th 2022, is this the one you're refering to?

git+https://github.com/vshymanskyy/blynk-library-python@f84633c#egg=blynk-library-python

Judas2016 avatar Dec 09 '22 01:12 Judas2016