gablau / node-red-contrib-blynk-ws

Old/Legacy Blynk library implementation for Node-RED using WebSockets
MIT License
31 stars 10 forks source link

Nodes showing as disconnected - websocket error #20

Closed 877dev closed 2 years ago

877dev commented 4 years ago

Hi @gablau hope you are well,

I had an issue today where node red was showing all Blynk nodes as disconnected, I rebooted node red with no effect, and updated to your latest version 1.0.3.

Node red log:

13 Apr 14:15:23 - [info] [blynk-ws-client:Blynk (LIVE SYSTEM)] Start secure connection: wss://139.59.206.133:80/websockets
13 Apr 14:15:23 - [error] [blynk-ws-client:Blynk (LIVE SYSTEM)] Websocket Error: Client network socket disconnected before secure TLS connection was established
13 Apr 14:15:23 - [info] [blynk-ws-client:Blynk (LIVE SYSTEM)] Client Error
13 Apr 14:15:23 - [info] [blynk-ws-client:Blynk (LIVE SYSTEM)] Reconnect in 5 seconds...
13 Apr 14:15:23 - [info] [blynk-ws-client:Blynk (LIVE SYSTEM)] Websocket closed: wss://139.59.206.133:80/websockets
13 Apr 14:15:23 - [info] [blynk-ws-client:Blynk (LIVE SYSTEM)] Reconnect in 5 seconds...

I thought I had fixed this by going into node properties and changing wss://blynk-cloud.com/websockets to non-SSL ws://blynk-cloud.com/websockets, deployed and it all connected fine.

If I try and change it back to SSL wss it disconnects all the nodes when I redeploy, now I am experimenting and cannot get it to connect at all!

So I am asking:

1) Any idea what the issue is?

2) If the nodes disconnect again, is there a way to be notified/trigger a flow?

Many thanks 877

877dev commented 4 years ago

After a while playing I have figured out how to replicate the issue.

I have two clients set up in node red, my 'LIVE' system and a 'read only' one for the wife. This has been running fine like this for many months, both using the SLL wss webhook (cloud).

image

If either of those is set to wss, it disconnects and stays disconnected. If both are set to ws (non-ssl) then is connects fine.

But, whenever I redeploy, I get this error, and the nodes show as disconnected for around 5-10secs before connecting:

image

gablau commented 3 years ago

Hello, this is a big problem, but I was unable to reproduce it locally. However, I have noticed that there are some problems with opening and closing websockets, particularly when deploying a flow.

Could you try to make the settings that give error and then, after having done the deployment, restart the nodered service? please attach me the logs you boot of nodered

let me know

877dev commented 3 years ago

Edited this post as it was my mistake, not an error.

As I am using a Docker container, the Blynk container port is mapped to 8180 to avoid conflicts. I was using port 8080 which was throwing up errors. Now I am using port 8180 it works fine, as does 9443.

image https://sensorsiot.github.io/IOTstack/Networking/

However, I was having this issue previously on port 9443 with the cloud server, so I think it is still a valid issue. But I am having trouble reproducing it.

877dev commented 3 years ago

@gablau Feb 2021, the problem has reoccurred over this last week. I restarted node red, here's the logs (I deleted some sensitive Alexa info only): _nodered_logs.log

For now this has fixed it: My account - same settings: image

Family account - changed wss://blynk-cloud.com/websockets to wss://blynk-cloud.com/websocket (removed s) image

Possibly linked to this somehow? https://community.blynk.cc/t/solved-blynk-node-red-websocket-error-after-upgrading-server-to-0-41-15/51422

877dev commented 3 years ago

Darn, just changed a few unrelated flows and the error is back, can't seem to fix it this time.....

21-02-2021_2038 error.log

Peterkn2001 commented 3 years ago

Are you sure you changed the url for your “ LIVE SYSTEM” connection? Did you restart Node-Red afterwards?

Pete.

877dev commented 3 years ago

Hi Pete,

I did not need to change the LIVE url at first, it was working fine. Restarting seemed to give mixed results, sometimes connecting or not.

Last night I changed both to "wss://blynk-cloud.com/websocket" and restarted, and it seems to be fine - (again). Fingers crossed...

877dev commented 3 years ago

@Peterkn2001 for no apparent reason I am today getting this every so often, nodes are connecting though... Are you having the same?

image

Actually scratch that, everything's disconnected now! :/

gablau commented 2 years ago

Hi @877dev, i released a new version 1.0.6, could you see if it solves this problem?

I fixed some things about the websocket connection.

Best Regards

877dev commented 2 years ago

Hi @gablau,

I just updated and it seems to be working fine so far, although I have had no issues for a while now. Thanks