rakusan2 / FRC-NT-Client

WPI NetworkTables Client for Node
https://www.npmjs.com/package/wpilib-nt-client
MIT License
21 stars 5 forks source link

Client.aliveTimer not a Timeout #1

Closed primetoxinz closed 7 years ago

primetoxinz commented 7 years ago

When attempting the basic

ntClient.start((con, err) => {
    console.log({con, err});
    if (!con)
      throw err;
    }
  );

it throws

Uncaught TypeError: this.aliveTimer.unref is not a function
    at Client.write (/home/tyler/Programming/FRCDashboard/node_modules/wpilib-nt-client/index.js:452)
    at aliveTimer.setTimeout (/home/tyler/Programming/FRCDashboard/node_modules/wpilib-nt-client/index.js:451)

Meaning that for some reason, even though this.aliveTimer is always initialized via setTimeout it is not a Timeout. Any ideas?

primetoxinz commented 7 years ago

Appears this is due to running the Client in the Electron render process, which is not a normal Node environment and has it's own setTimeout function. It would be appreciated if you added a note that this has to be initializing in the Node main.

rakusan2 commented 7 years ago

This is an issue with unref not existing on the Timer Object that the renderer process uses

rakusan2 commented 7 years ago

Version 1.2.4 should now work in electrons renderer process