vshymanskyy / blynk-library-python

Blynk library for Python. Works with Python 2, Python 3, MicroPython.
https://blynk.io/
MIT License
287 stars 98 forks source link

Socket Disconnects - Blynk offline #65

Open Judas2016 opened 2 years ago

Judas2016 commented 2 years ago

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

pjlfrost commented 1 year ago

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

Judas2016 commented 1 year ago

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.

pjlfrost commented 1 year ago

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

Judas2016 commented 1 year ago

@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