Unsecured connection attempt or not supported protocol

Hey all,

need some help, as I’ve been banging my head against the wall for several hours now. I tried running a project I had on an old pi that was working fine in the past. Unfortunately, with the various android client and local server version changes, something didn’t want to cooperate with me so I set about upgrading the versions.

Ever since, I can’t get it to work. The server runs ok and the Blynk app (latest Android) connects fine. What I can’t get right is the connection between the blynk-library (node.js) and the server.

Whenever I run it, I get this output:

OnOff mode
Connecting to TCP: localhost 8441
Connected
Disconnect blynk
DISCONNECT

This goes in a loop. It reconnects, then disconnects again. And in the server’s log, every time there’s a connection attempt I get:

02:41:02.930 DEBUG- Unsecured connection attempt or not supported protocol. Channel : /127.0.0.1:48782. Reason : io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 02000100206338623139383735306536333466613461633065346365633866333033336334

To eliminate all possible issues stemming from my code and/or project, I created a new project that only has a button in it and a new .js file that’s as follows:

pi@rPi:~/blynk $ cat test.js
#!/usr/bin/env node

var AUTH = 'my_auth_token';
var BlynkLib = require('/usr/local/lib/node_modules/blynk-library');
var blynk = new BlynkLib.Blynk(AUTH, options = {
  connector : new BlynkLib.TcpClient( options = { addr:"localhost", port:8441 } )
});

var v1 = new blynk.VirtualPin(1);


v1.on('write', function(param) {
  console.log('V1:', param);
});

blynk.on('connect', function() {
  console.log("Blynk ready.");
//  blynk.syncAll();
});

blynk.on('disconnect', function() { console.log("DISCONNECT"); });

Node version:

pi@rPi:~/blynk $ node -v
v6.9.5

blynk server version:

pi@rPi:~/blynk/server $ ls -al server
lrwxrwxrwx 1 pi pi 23 Mar 17 16:39 server -> server-0.33.4-java8.jar

blynk-library version:

pi@rPi:~/blynk $ sudo npm install -g blynk-library
/opt/nodejs/bin/blynk-client -> /opt/nodejs/lib/node_modules/blynk-library/bin/blynk-client.js
/opt/nodejs/bin/blynk-ctrl -> /opt/nodejs/lib/node_modules/blynk-library/bin/blynk-ctrl.js
/opt/nodejs/lib
└── blynk-library@0.4.7

Would appreciate any help. I’m stumped!

Port 8080 now

EDIT - looks like you might be trying to use SSL (port 8441) but using TCP connection?

Try

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

Just tried with 127.0.0.1 to port 8441, same results:

02:51:24.003 DEBUG- Unsecured connection attempt or not supported protocol. Channel : /127.0.0.1:48788. Reason : io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 02000100206338623139383735306536333466613461633065346365633866333033336334

Are you still using this?

Yes, I was. Sorry, missed it. Changed as per snipped above, now I’m getting the following:

OnOff mode
Connecting to: 127.0.0.1 8441
SSL authorization...
SSL not authorized

And in the server log:

02:57:12.621 DEBUG- [id: 0x7acc2e54, L:/127.0.0.1:8441 - R:/127.0.0.1:48795] HANDSHAKEN: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

Try just the TCP and port 8080… works great for me.

trying with:

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

I get:

OnOff mode
Connecting to TCP: 127.0.0.1 8080
events.js:165
      throw err;
      ^

Error: Uncaught, unspecified "error" event. (ECONNREFUSED)
    at Blynk.emit (events.js:163:17)
    at Blynk.error (/opt/nodejs/lib/node_modules/blynk-library/blynk.js:590:8)
    at .<anonymous> (/opt/nodejs/lib/node_modules/blynk-library/blynk.js:553:48)
    at emitOne (events.js:96:13)
    at emit (events.js:188:7)
    at Socket.<anonymous> (/opt/nodejs/lib/node_modules/blynk-library/blynk-node.js:59:14)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1278:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)

Is your Local Server on the same RPi as this client? Try “Localhost” or even the RPis IP “xxx.xxx.xxx.xxx”

Yep, same machine. And swapping in localhost or the actual IP address makes no difference.

Well you can try Googling this error in relation to NodeJS…

Otherwise my guess is as good as yours…

Have you ran the port redirection as shown in the announcement topic I posted above?

As Server and Client are on same device, perhaps try without the port?

Found this by searching this forum…

@Gunner I’ve tried all of the above (except the port redirection – there’s no router in the middle or anything, this is a straight local subnet setup) and so far no luck.

I’ll give it some time in case someone has any bright ideas, otherwise I think I’ll just bit the bullet and start from scratch…

Thanks for trying to help :slight_smile:

I think this part is more for the server then any router… did you run this on your RPi?

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

Yes, I tried it. No joy.