Comments (11)
has there been any change on this? currently when an internet loss happens the script has no idea to reconnect.
thanks
from blynk-library-js.
Is there any update on this?
from blynk-library-js.
on blynk.js coment line 592: this.emit('error', err.code?err.code:'ERROR');
Blynk.prototype.error = function(err) {
var self = this;
//if we throw error and user doesn't handle it, app crashes. is it worth it?
//this.emit('error', err.code?err.code:'ERROR'); //comment and nodejs not crash on connection error
console.error('Error', err.code);
//starting reconnect procedure if not already in connecting loop
if(!self.timerConn) {
setTimeout(function () {self.connect()}, 5000);
}
};
Nodejs not crash on connection error, and try to reconnect!!
from blynk-library-js.
It's not working very well. It continuously try to reconnect and disconnect in an infinite loop.
from blynk-library-js.
If the blynk server is unavailable for some reason, you can observe the error message and choose to disconnect if you wish. The intent of the loop is to keep trying to connect, for example, in the case of temporary network drop out.
from blynk-library-js.
What I meant for loop, is that when it disconnects, it tries to reconnect but somehow it also try to disconnect in a continuous loop where it reconnects and immediately disconnect and so on forever.
I tried to debug a bit but I wasn't able to find the failure point.
To reproduce just disconnect internet and reconnect internet.
from blynk-library-js.
I'm currently on local blynk server.
I pulled the network cable to blynk server then looked at my hw client console and see no change. Also on UI, no change. (Likely tcp maintaining session during timeout period)
Reconnect network cable then touched the UI connection status icon. A warning message was momentarily displayed (too fast for me to read and remember). Back on my hw client console, I now see two error messages: one is ECONNRESET, the other is 'undefined'. I also received two 'connect' events but no 'disconnect' event.
My app is working but I now have three connect handlers running because I expected to receive disconnect before another connect. This is a blynk library bug but I can easily work around it by using a 'once' connect handler.
In short, I didn't see the same problem you are experiencing. Did you pull the network connection from the host running your hw client? I can't easily do that since mine is wireless.
from blynk-library-js.
I pulled the network cable from the host running this library (my "hardware").
Aren't the three connect handlers making some mess, like trying to disconnect and so on?
from blynk-library-js.
Ok, just ran the same experiment on my host running blynk-library-js. Got these messages:
Disconnect blynk
2018.11.03 1:47 pm - warn: Received disconnect from Blynk server
REARMING DISCONNECT
Connecting to TCP: 10.0.100.7 8080
Connected
Authorized
Which seems to work as expected. What version of the blynk library are you using - installed from npm or git repo?
from blynk-library-js.
From repo, latest commit (but it was the same 10-15 commits ago). I'm using public server.
from blynk-library-js.
process.on('uncaughtException', err => {
console.log(err)
})
from blynk-library-js.
Related Issues (20)
- UTF8 values are not working. HOT 4
- Make an option to enable debug
- Fix to avoid disconnects when writing while not ready HOT 1
- OnOff GPIO read error for Raspberry Pi. HOT 1
- Auto-generate dist/blynk-espruino.js
- WidgetRTC? where isit ? HOT 1
- Espruino doesn't seems to work HOT 2
- Uncaught error on disconnect
- Lots of connect and disconnect, SSL not authorized, and crash HOT 5
- Application crashed: Cannot read property 'authorized' of null HOT 1
- digitalWrite GPIO pins with code HOT 2
- 'SSL not authorized' when using Let's Encrypt HOT 3
- No longer connects HOT 1
- VM the host system is sleeping but still connect
- 'Blynk_App_Connected' event is not supported?
- Typenscript Blynk Definition
- SSL not authorized since yesterday... HOT 5
- is support Blynk.Edgent ?
- INVALID_TOKEN
- Library does not work at all with new version of Blynk (2.0)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blynk-library-js.