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!