Coder Social home page Coder Social logo

node-rfb2's Introduction

node-rfb2

RFB wire protocol client and server

Client

var rfb = require('rfb2');
var r = rfb.createConnection({
  host: '127.0.0.1',
  port: 5900,
  password: 'secret'
});

r.on('connect', function() {
  console.log('successfully connected and authorised');
  console.log('remote screen name: ' + r.title + ' width:' + r.width + ' height: ' + r.height);
};

r.pointerEvent(100, 100, 0); // x, y, button state (bit mask for each mouse button)
r.keyEvent(40, 0);           // keycode, is down?
r.updateClipboard('send text to remote clipboard');

// screen updates
r.on('rect', function(rect) {
   switch(rect.encoding) {
   rfb.encodings.raw:
      // rect.x, rect.y, rect.width, rect.height, rect.data
      // pixmap format is in r.bpp, r.depth, r.redMask, greenMask, blueMask, redShift, greenShift, blueShift
   rfb.encodings.copyRect:
      // pseudo-rectangle
      // copy rectangle from rect.src.x, rect.src.y, rect.width, rect.height, to rect.x, rect.y
   rfb.encodings.hextile:
      // not fully implemented
      rect.on('tile', handleHextileTile); // emitted for each subtile
   }
}

r.on('clipboard', function(newPasteBufData) {
  console.log('remote clipboard updated!', newPasteBufData);
});

r.on('bell' console.log.bind(null, 'Bell!!'));

// force update
// updates are requested automatically after each new received update
// you may want to have more frequent updates for high latency / high bandwith connection
r.requestUpdate(false, 0, 0, r.width, r.height); // incremental?, x, y, w, h

r.end(); // close connection

Server

Start the server with:

node rfbserver.js

Then use a VNC client and connect to port 5910. The server requires the password tetris to access.

Status:

Ready

  • pointer, keyboard, cutText, requestUpdate client messages
  • colormap, bell, cutText server messages
  • Raw FB update encoding
  • pseudoDesktopSize and copyRect pseudo rect updates
  • record/replay to/from file

In progress:

  • Hextile, encoding support
  • Server side protocol

TODO:

  • ZRle, RRE, CoRRE, Zlib, Tight encodings
  • ARD and MS security types
  • VNC server with x11 and COMPOSITE/DAMAGE extensions

see also:

preformance

( TODO: benchmark )

Bitdeli Badge

node-rfb2's People

Contributors

sidorares avatar follower avatar bitdeli-chef avatar

Watchers

James Cloos avatar James Futhey avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.