Git Product home page Git Product logo

novnc-core's Introduction

This is the result of running the following command on noVNC:

./utils/use_require.js --as commonjs

Updates are automatically published weekly (as necessary, when my computer is on) using noVNC-core-autopublish.

Usage

To install:

$ npm install --save novnc-core

To use:

import RFB from 'novnc-core'

/*
try {
  var rfb = new RFB(document.getElementById('noVNC-canvas'), url);
} catch (exc) {
    console.log('Unable to create RFB client -- ' + exc, 'error');
    return;
}

/* Listen for updates by attaching event listeners for the following events:
 * connect
 * disconnect
 * credentialsrequired
 * securityfailure
 * clipboard
 * bell
 * desktopname
 * capabilities
 */

// Full documentation can be found at https://github.com/novnc/noVNC/blob/35dd3c2299b3e13e2b57a2a34be723fb01014ee3/docs/API.md

Copyright

See LICENSE.txt for a full accounting of the licensing of the core files. Assume that this repository/package is Copyright (C) 2017-2018 Larry Price under the Mozilla Public License 2.0, but the code itself retains the copyrights listed in the original repository (and LICENSE.txt file).

Version History

  • v0.1.0
    • Maps to noVNC/noVNC a5c366b834cbeb8e89406e0374e2a0903cedfbe8
  • v0.1.1
    • Maps to noVNC/noVNC 55b459b47961e2ca2eb125408a1ddc60d0251457
  • v0.2.0
    • Maps to noVNC/noVNC 35dd3c2299b3e13e2b57a2a34be723fb01014ee3
  • v0.2.1
    • Modify v0.2.0 to remove let keyword
  • v0.2.2
    • Maps to noVNC/noVNC 18439b0680811f175e39ce381d0faa138f868d3c
  • 0.3.0
    • Maps to noVNC/noVNC 1.1.0

novnc-core's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

novnc-core's Issues

Typings are not in line with usage description

The Typings for the RFB Object / Library are not in line with your usage description on npm.

When I want to create an RFB object, your guide says to give it a target block element, the Websocket-vnc url as well as some options. This is the way like it's documented on noVNC github repo. I assume, that this is the new API interface.
The Typings say, that the RFB Constructor wants to have an 'options parameter with most options and event handlers attached.

Code Snipped in line with typings

 const options: NvRFBDefaults = {
          target: this.vncContainer.nativeElement,
          onDisconnected: (rfb: RFB, reason) => {
            console.log('VNC Disconnect');
          },
          onPasswordRequired: (rfb: RFB, ) => {
            console.log('VNC Credentials Required');
          }
        };

        this.connection = new RFB(options);

This gives me a runtime error:

ERROR Error: Must specify URL
    at new RFB (VM85 iframe.bundle.js:211765)

Code Snipped in line with documentation

The example on noVNC github says:

  // Creating a new RFB object will start a new connection
        rfb = new RFB(document.getElementById('screen'), url,
                      { credentials: { password: password } });
        // Add listeners to important events from the RFB module
        rfb.addEventListener("connect",  connectedToServer);
        rfb.addEventListener("disconnect", disconnectedFromServer);
        rfb.addEventListener("credentialsrequired", credentialsAreRequired);
        rfb.addEventListener("desktopname", updateDesktopName);
        // Set parameters that can be changed on an active connection
        rfb.viewOnly = readQueryVariable('view_only', false);
        rfb.scaleViewport = readQueryVariable('scale', false);

My code looks like this:

// @ts-ignore
        this.connection = new RFB(
          this.vncContainer.nativeElement,
          connectionInfo.fullWebsocketUrl
        );

        this.connection.scaleViewport = true;
        this.connection.focusOnClick = true;
        this.connection.clipViewport = true;
        this.connection.resizeSession = true;
        this.connection.viewOnly = false;

        this.connection.addEventlistener('disconnect', () => {
          console.log('VNC Disconnect');
        });

        this.connection.addEventListener('securityfailure', () => {
          console.log('VNC Security Failure');
        });

        this.connection.addEventListener('credentialsrequired', () => {
          console.log('VNC Credentials Required');
        });

This seems to work.

Can you please adjust the typings?

I use

  • "novnc-core": "^0.2.1"
  • "@types/novnc-core": "^0.1.1" (because these are the newest ones available)

I tired "@novnc/novnc", which seems to be the official package. But, unfortunately, this is an ES6 Module without Typescript definition files, which seems why Webstorm does not recognize the package at all, even when it's already installed.

novnc 1.0.0

Hello,

thank you for the type! Have you planed to support the latest release (1.0.0) of the novnc core too?

usage example

hey adjust your example:

import RFB from 'novnc-browser'
to
import RFB from 'novnc-core'

Is this project still maintained?

Hello Larry,

sorry if I disturb you. I would like to known if this project is still maintained, because I see last commit was on Nov 29, 2018.

Thanks,
Mark

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.