How to use the @novnc/novnc/core/rfb function in @novnc/novnc

To help you get started, we’ve selected a few @novnc/novnc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oVirt / ovirt-web-ui / src / react-console / index.js View on Github external
vncLogging,
      onInitFailed,
    } = this.props

    NovncLog.init_logging(vncLogging)
    try {
      const protocol = encrypt ? 'wss' : 'ws'
      const url = `${protocol}://${host}:${port}/${path}`

      const options = {
        repeaterID,
        shared,
        credentials,
      }

      this.rfb = new RFB(this.novncElem, url, options)
      this.addEventListeners()
      this.rfb.viewOnly = viewOnly
      this.rfb.scaleViewport = scaleViewport // if the remote session is smaller than HTML container, the view will be centered
      this.rfb.resizeSession = resizeSession
    } catch (e) {
      onInitFailed && onInitFailed(e)
      this.rfb = undefined
    }
  }
github patternfly / patternfly-react / packages / react-console / src / VncConsole / VncConsole.js View on Github external
vncLogging,
      onInitFailed
    } = this.props;

    NovncLog.init_logging(vncLogging);
    try {
      const protocol = encrypt ? 'wss' : 'ws';
      const url = `${protocol}://${host}:${port}/${path}`;

      const options = {
        repeaterID,
        shared,
        credentials
      };

      this.rfb = new RFB(this.novncElem, url, options);
      this.rfb.addEventListener('connect', this.onConnected);
      this.rfb.addEventListener('disconnect', this.onDisconnected);
      this.rfb.addEventListener('securityfailure', this.onSecurityFailure);
      this.rfb.viewOnly = viewOnly;
      this.rfb.scaleViewport = false; // if the remote session is smaller than HTML container, the view will be centered
      this.rfb.resizeSession = resizeSession;
    } catch (e) {
      onInitFailed && onInitFailed(e);
      this.rfb = undefined;
    }
  }
github aerokube / selenoid-ui / ui / src / components / VncCard / VncScreen.js View on Github external
createRFB(link, port, session, secure) {
        const rfb = new RFB(this.canvas, `${secure ? "wss" : "ws"}://${link.hostname}:${port}/ws/vnc/${session}`, {
            credentials: {
                password: "selenoid",
            },
        });

        rfb.addEventListener("connect", this.onVNCConnect);
        rfb.addEventListener("disconnect", this.onVNCDisconnect);

        rfb.scaleViewport = true;
        rfb.resizeSession = true;
        rfb.viewOnly = true;
        return rfb;
    }
github theforeman / foreman / webpack / assets / javascripts / bundle_novnc.js View on Github external
$(document).on('ContentLoad', () => {
  const vncScreen = $('#noVNC_screen');

  if (vncScreen.length) {
    $('#sendCtrlAltDelButton').on('click', sendCtrlAltDel);

    const protocol = $('#vnc').data('encrypt') ? 'wss' : 'ws';
    const host = window.location.hostname;
    const port = $('#vnc').attr('data-port');
    const url = `${protocol}://${host}:${port}`;
    const password = $('#vnc').attr('data-password');

    rfb = new RFB(vncScreen.get(0), url, {
      credentials: {
        password,
      },
    });

    rfb.addEventListener('connect', connectFinished);
    rfb.addEventListener('disconnect', disconnectFinished);
    rfb.addEventListener('securityfailure', securityFailed);

    showStatus('disconnected', __('Loading...'));
  }
});
github patternfly / patternfly-react / packages / patternfly-3 / react-console / src / VncConsole / VncConsole.js View on Github external
vncLogging,
      onInitFailed
    } = this.props;

    NovncLog.init_logging(vncLogging);
    try {
      const protocol = encrypt ? 'wss' : 'ws';
      const url = `${protocol}://${host}:${port}/${path}`;

      const options = {
        repeaterID,
        shared,
        credentials
      };

      this.rfb = new RFB(this.novncElem, url, options);
      this.addEventListeners();
      this.rfb.viewOnly = viewOnly;
      this.rfb.scaleViewport = scaleViewport;
      this.rfb.resizeSession = resizeSession;
    } catch (e) {
      onInitFailed && onInitFailed(e);
      this.rfb = undefined;
    }
  }
github uyuni-project / uyuni / web / html / src / manager / virtualization / guests / console / vnc-client.js View on Github external
connect = () => {
    if (this.canvasId != null && this.socketUrl != null) {
      const rfb = new RFB(document.getElementById(this.canvasId), this.socketUrl);
      rfb.addEventListener('connect', this.onConnect);
      rfb.addEventListener('disconnect', (e) => {
        const error = e.detail.clean ? undefined : t('Something went wrong, connection is closed');
        if (this.disconnected != null) {
          this.disconnected(error);
        }
      });
      rfb.addEventListener('credentialsrequired',
        () => {
          if (this.askPassword != null) {
            this.askPassword().then(password => rfb.sendCredentials({ password }));
          }
        });
      rfb.scaleViewport = false;
      rfb.resizeSession = false;
      this.rfb = rfb;

@novnc/novnc

An HTML5 VNC client

MPL-2.0
Latest version published 1 year ago

Package Health Score

75 / 100
Full package analysis