JS library keeps connecting and disconnecting

See: https://github.com/vshymanskyy/blynk-library-js/issues/40

Sometimes I get continuously connect and disconnects in rapid succession, then SSL certificate fail and suddenly everything crashes. Using the JS library.
I don’t know if it is a library’s fault or some problems in the server. Yesterday and today is happening much more frequently, but it might be a coincidence.

Probably something in your code… or the fact that you are using SSL?? I am using the JS library without issues, but without SSL.

Post your entire sketch here… formatted properly :wink:

Blynk - FTFC

Ahh… yes… in your long but almost uniformitive post on Github… there is a tiny reference - SSL not authorized

How to not use SSL?
And why 99% of the time it works then it fails?

image

Did you measure that statistic with a slider? Are you sure it is not “works 0.99%” :stuck_out_tongue_winking_eye:

Seriously, I don’t know… but JS is more a Beta+ library then anything official, as far as I can tell… so stability issues might occasionally happen, particularly with the overhead demand of SSL.

I still don’t get how to not use SSL…:frowning:

By comparing the two examples… Sesame Street stuff… :musical_score:one of these things is not like the other…

SSL

var blynk = new Blynk.Blynk(AUTH,
  options= { addr:"127.0.0.1", port:8441 }
);

TCP

var blynk = new Blynk.Blynk(AUTH, options = {
  connector : new Blynk.TcpClient( options = { addr:"127.0.0.1", port:8442 } )  // NOTE port should now be 8080
});
2 Likes

Using TCP without SSL seems to work :wink:

1 Like

I talked too early.

Connecting to TCP: blynk-cloud.com 8442
Connected
Disconnect blynk
Connecting to TCP: blynk-cloud.com 8442
Connected
Disconnect blynk

and so on forever. At least it is not crashing. I think there is a loop somewhere (I wasn’t able to find it) that when it disconnects, it tries to reconnect and disconnect at the same time going into a loop of disconnection and reconnection. And with SSL I think every time a new instance of something is created, such that every cycle more and more instances are present, leading to a crash when they are too much (memory?).

Could be something in your script…

Or possibly the RPi is just ‘burping’ it’s WiFi? My RPi3 was very unstable with it’s WiFi… I never bothered to troubleshoot as I can, and did, easily plug it into Ethernet on my workbench. Solid connection since.

I’m on ethernet. And in my code there are no connect/disconnect at all.

Just noticed… Why is it still using 8442? Should be 8080 now

I’m using public server. And it’s working :slight_smile:
Isn’t 8080 for private servers?

No it’s for Blynk servers of any kind.