Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The steps to utilize the node-rdpjs library are as follows:

  1. Install the library using the npm package manager:
npm install node-rdpjs
  1. Create a new instance of the RDP client:
const RDP = require('node-rdpjs');
const rdp = new RDP();
  1. Connect to the remote desktop server by calling the connect method:
rdp.connect({
    address: '192.168.0.10',
    port: 3389,
    user: 'username',
    pass: 'password'
});
  1. Once connected, you can receive screen updates by subscribing to the desktop event:
rdp.on('desktop', (image) => {
    // do something with the screen image
});
  1. You can also interact with the remote desktop by sending keyboard and mouse events to the server using the sendInput method:
rdp.sendInput({keyCode: 13, keyState: 0}); // send the "Enter" key
  1. To disconnect from the server, call the disconnect method:
rdp.disconnect();

Note: The node-rdpjs library uses the node-rdp library as its backend, which depends on the FreeRDP library. Therefore, you must have FreeRDP installed on your system before using node-rdpjs.