Trying to set up a VNC client using AngularJS (tutorial link here), but encountering an error while running the application: TypeError: RFB is not a function
Below is the server.js code snippet:
var RFB = require('rfb2'),
io = require('socket.io'),
Png = require('../node_modules/node-png/lib/png').Png,
express = require('express'),
http = require('http'),
clients = [],
Config = {
HTTP_PORT: 8090
};
function createRfbConnection(config, socket) {
try {
var r = RFB({
host: 'config.hostname',
port: config.port,
password: config.password,
securityType: 'vnc',
});
} catch (e) {
console.log(e);
}
addEventHandlers(r, socket);
return r;
}
function addEventHandlers(r, socket) {
var initialized = false,
screenWidth, screenHeight;
function handleConnection(width, height) {
//handle connection details here
}
//event handlers for RFB instance
}
function encodeFrame(rect) {
//encode frame logic here
}
function disconnectClient(socket) {
//disconnect logic implementation
}
exports.run = function () {
//server setup code here
};
Error message:
Listening on port 8090
Client connected
[TypeError: RFB is not a function]
Missing error handler on `socket`.
TypeError: Cannot read property 'on' of undefined
//error messages log display
Seeking assistance with resolving this issue. Any help would be appreciated!