Unable to use most of the methods of samsung-tv-control package, getti

Want to access my Samsung Smart TV (Tizen OS) using the IP protocol, for that using samsung-tv-control package npm package link , I am unable to use most of the methods, in the below code I am unable to get the token and unable to get the installed applications information. Also not sure what must be the token value in the config variable.

Error → RangeError: Invalid WebSocket frame: invalid status code 1005

Here is my node.js code -

const express = require("express");
const { Samsung } = require("samsung-tv-control");
const app = express();

let isAvailable = false;
const config = {
  debug: true, // Default: false
  ip: "xxx.xx.xxx.xxx",
  mac: "xx:xx:xx:xx:xx:xx",
  nameApp: "NodeJS", // Default: NodeJS
  port: 8001, // Default: 8002,
  noServer: true,
  token: "", // token value (but not sure what to put here, what must be the token value ?)
};

const control = new Samsung(config);

app.get("/", async (req, res) => {
  res.send("TV control" + JSON.stringify(control));
    try {
      control.turnOn();
      isAvailable = await control.isAvailable();
      console.log("isAvailable: ", isAvailable); // getting true
      if (isAvailable) {
        //getting error on using this code
        control.getToken((token) => {   
          console.info("# Response getToken:", token);
        });
        //getting error on using this code
        control.getAppsFromTV((err, res) => {
            if (!err) {
              console.log("# Response getAppsFromTV", res);
            }
          });
      }
    } catch (e) {
      console.log(e);
    }
});

app.listen(3000, () => {
  console.log("Server running successfully on 3000");
});

Getting the following error →


I Want to access my Samsung Smart TV (Tizen OS) using the IP protocol to get the Installed apps on the TV and launch them as per the request.

Original Question → node.js - Unable to use most of the methods of samsung-tv-control package, getting error -RangeError: Invalid WebSocket frame: invalid status code 1005 - Stack Overflow