Push data to Blynk with Node.js

Hi everyone,

I’m following this guide from user GTT to use Node.js to communicate Blynk.

I would like push data to every time a function is run but I’m having some issues. I set up the connection as described:

const Blynk = require('blynk-library');  // Links variable 'Blynk' to the Blynk Library
const AUTH = 'xxxxxxxxxx';  // Your top secret auth code
const blynk = new Blynk.Blynk(AUTH, options = {
  connector : new Blynk.TcpClient()

And then proceed to push data or do a one time write VirtualPin 30.

var pin = new blynk.VirtualPin(30); 
blynk.syncVirtual(30);  // Sync pin to process command

This doesn’t work though and I’m not sure where I’m going wrong (the display value widget is set to push) . If I set the widget to request data every second and then listen for the widget read, then that works:

pin.on('read', () => {  // Widget calls for data
  //This works and the widget is updated
  pin.write(new Date().getSeconds());  // Sends the seconds 0-59 to the Display Widget