skydiver / ewelink-api

eWeLink API for JavaScript
https://www.npmjs.com/package/ewelink-api
MIT License
265 stars 109 forks source link

UnhandledPromiseRejectionWarning: Error: Can't send data because WebSocket is not opened. #95

Open robert777robert777 opened 4 years ago

robert777robert777 commented 4 years ago

i get the error: UnhandledPromiseRejectionWarning: Error: Can't send data because WebSocket is not opened. when i lose internet connectivity using the example websocket code. Any way to handle this case (reconnect or just abort)?

ttz642 commented 4 years ago

I came across this before and made some suggested changes, now I've updated to 3.1.0-ws I'm getting the problem again, I'll patch the code and I'll post proposed changes here.

I've update my solution to work with 3.1.0-ws, see #65