{"id":22433048,"url":"https://github.com/roerohan/react-vnc","last_synced_at":"2025-05-16T06:04:37.863Z","repository":{"id":40646857,"uuid":"356027726","full_name":"roerohan/react-vnc","owner":"roerohan","description":"A React Component to connect to a websockified VNC server using noVNC.","archived":false,"fork":false,"pushed_at":"2025-04-23T08:38:10.000Z","size":3435,"stargazers_count":118,"open_issues_count":7,"forks_count":28,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T09:35:31.661Z","etag":null,"topics":["hacktoberfest","javascript","npm-package","react","typescript"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/react-vnc","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roerohan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"roerohan","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://buymeacoffee.com/roerohan"]}},"created_at":"2021-04-08T19:34:42.000Z","updated_at":"2025-04-23T08:37:50.000Z","dependencies_parsed_at":"2023-02-12T07:16:11.222Z","dependency_job_id":"5130e627-54b0-4e9e-9419-53e6b2dc3cc6","html_url":"https://github.com/roerohan/react-vnc","commit_stats":{"total_commits":152,"total_committers":3,"mean_commits":"50.666666666666664","dds":0.5394736842105263,"last_synced_commit":"a98e04dd628d58b637c40aa2c59ece3207bd2594"},"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roerohan%2Freact-vnc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roerohan%2Freact-vnc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roerohan%2Freact-vnc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roerohan%2Freact-vnc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roerohan","download_url":"https://codeload.github.com/roerohan/react-vnc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478186,"owners_count":22077675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","javascript","npm-package","react","typescript"],"created_at":"2024-12-05T22:13:45.850Z","updated_at":"2025-05-16T06:04:37.857Z","avatar_url":"https://github.com/roerohan.png","language":"TypeScript","funding_links":["https://ko-fi.com/roerohan","https://buymeacoffee.com/roerohan"],"categories":[],"sub_categories":[],"readme":"[![Issues][issues-shield]][issues-url]\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n  \u003c!-- \u003ca href=\"https://github.com/roerohan/react-vnc\"\u003e\n    \u003cimg src=\"https://project-logo.png\" alt=\"Logo\" width=\"80\"\u003e\n  \u003c/a\u003e --\u003e\n\n  \u003ch3 align=\"center\"\u003ereact-vnc\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    A React Component to connect to a websockified VNC client using noVNC.\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/roerohan/react-vnc\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://roerohan.github.io/react-vnc/\"\u003eView Demo\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/roerohan/react-vnc/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/roerohan/react-vnc/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n## Table of Contents\n\n* [About the Project](#about-the-project)\n  * [Built With](#built-with)\n  * [Demo](#demo)\n* [Getting Started](#getting-started)\n  * [Prerequisites](#prerequisites)\n  * [Installation](#installation)\n* [Usage](#usage)\n* [Roadmap](#roadmap)\n* [Contributing](#contributing)\n* [License](#license)\n* [Contributors](#contributors-)\n\n\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## About The Project\n\n[noVNC](https://github.com/novnc/noVNC) is a VNC client web application using which you can view a VNC stream directly on a browser. It uses [websockify](https://github.com/novnc/websockify) to convert the VNC stream into a websocket stream, which can be viewed on a browser. This library provides a `React` component wrapper around the `noVNC` web client.\n\nUsing this library, you can easily display a VNC stream on a page of your web application. [Here](#usage) is an example.\n\n### Demo\n\nA demo website using the `react-vnc` library is hosted on [https://roerohan.github.io/react-vnc/](https://roerohan.github.io/react-vnc/). The source for this application can be found in [src/App.tsx](./src/App.tsx).\n\n\u003cimg src=\"./public/demo.png\" alt=\"demo\" width=\"800\"\u003e\n\n\n### Built With\n\n* [React](https://reactjs.org)\n* [noVNC](https://github.com/novnc/noVNC)\n\n\n\n\u003c!-- GETTING STARTED --\u003e\n## Getting Started\n\n### Installation\n\nTo install the library, you can run the following command:\n\n```bash\nnpm i react-vnc\n```\n\n### Contribution\n\nIn order to run the project locally, follow these steps:\n\n1. Clone the repository.\n```bash\ngit clone git@github.com:roerohan/react-vnc.git\ncd react-vnc\n```\n\n2. Install the packages and submodules.\n```bash\nnpm install\ngit submodule update --init --recursive\n```\n\n3. To run the sample `react-vnc` web application:\n```bash\necho \"REACT_APP_VNC_URL=ws://your-vnc-url.com\" \u003e .env\nnpm start\n```\n\n4. To build the library, make changes inside the `lib` folder, then run:\n```bash\nnpm run build:lib\n```\n\n\n\u003c!-- USAGE EXAMPLES --\u003e\n## Usage\n\nA `VncScreen` component is exposed from the library, to which you can pass the required and optional props. For example,\n\n```ts\nimport React, { useRef } from 'react';\nimport { VncScreen } from 'react-vnc';\n\nfunction App() {\n  const ref = useRef();\n\n  return (\n    \u003cVncScreen\n      url='ws://your-vnc-url.com'\n      scaleViewport\n      background=\"#000000\"\n      style={{\n        width: '75vw',\n        height: '75vh',\n      }}\n      ref={ref}\n    /\u003e\n  );\n}\n\nexport default App;\n```\n\nThe only `required` parameter is `url`, which must be a `ws://` or a `wss://` (websocket) URL for the library to function properly. noVNC can display only websocket URLs. All other props to `VncScreen` are optional. The following is a list (an interface) of all props along with their types.\n\n```ts\ntype EventListeners = { [T in NoVncEventType]?: (event: NoVncEvents[T]) =\u003e void };\n\ninterface Props {\n    url: string;\n    style?: object;\n    className?: string;\n    viewOnly?: boolean;\n    rfbOptions?: Partial\u003cNoVncOptions\u003e;\n    focusOnClick?: boolean;\n    clipViewport?: boolean;\n    dragViewport?: boolean;\n    scaleViewport?: boolean;\n    resizeSession?: boolean;\n    showDotCursor?: boolean;\n    background?: string;\n    qualityLevel?: number;\n    compressionLevel?: number;\n    autoConnect?: boolean;\n    retryDuration?: number;\n    debug?: boolean;\n    onConnect?: EventListeners['connect'];\n    onDisconnect?: EventListeners['disconnect'];\n    onCredentialsRequired?: EventListeners['credentialsrequired'];\n    onSecurityFailure?: EventListeners['securityfailure'];\n    onClipboard?: EventListeners['clipboard'];\n    onBell?: EventListeners['bell'];\n    onDesktopName?: EventListeners['desktopname'];\n    onCapabilities?: EventListeners['capabilities'];\n    onClippingViewport?: EventListeners['clippingviewport'];\n}\n\n// The types NoVncOptions, NoVncEventType and NoVncEvents are from the\n// @novnc/novnc library.\n```\n\nTo know more about these props, check out [API.md](https://github.com/novnc/noVNC/blob/master/docs/API.md#properties).\n\nYou can pass a `ref` to the `VncScreen` component, and access the `connect()` and `disconnect()` methods from the library. Check out [#18](https://github.com/roerohan/react-vnc/issues/18) for more details.\n\nThe `ref` object has the following type:\n```ts\ntype VncScreenHandle = {\n    connect: () =\u003e void;\n    disconnect: () =\u003e void;\n    connected: boolean;\n    sendCredentials: (credentials: NoVncOptions[\"credentials\"]) =\u003e void;\n    sendKey: (keysym: number, code: string, down?: boolean) =\u003e void;\n    sendCtrlAltDel: () =\u003e void;\n    focus: () =\u003e void;\n    blur: () =\u003e void;\n    machineShutdown: () =\u003e void;\n    machineReboot: () =\u003e void;\n    machineReset: () =\u003e void;\n    clipboardPaste: (text: string) =\u003e void;\n    rfb: RFB | null;\n    loading: boolean;\n    eventListeners: EventListeners;\n};\n```\n\nThe `onConnect`, `onDisconnect`, `onCredentialsRequired`, and `onDesktopName` props are optional, and there are existing defaults set for them. For example, the default `onDisconnect` function consists of some logic to retry connecting after a certain timeout (specified by `retryDuration`). Check out the default `_onConnect` and `_onDisconnect` functions in [VncScreen.tsx](./src/lib/VncScreen.tsx) for more details.\n\nThe `onConnect`, `onDisconnect`, and `onCredentialsRequired` callbacks can accept a single parameter `rfb`. This parameter is the `RFB` object, which is described by [**noVNC**](https://github.com/novnc/noVNC). Learn more about the `RFB` object [here](https://github.com/novnc/noVNC/blob/master/docs/API.md#rfb).\n\n\u003c!-- ROADMAP --\u003e\n## Roadmap\n\nSee the [open issues](https://github.com/roerohan/react-vnc/issues) for a list of proposed features (and known issues).\n\n\n\n\u003c!-- CONTRIBUTING --\u003e\n## Contributing\n\nContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'feat: Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\nYou are requested to follow the contribution guidelines specified in [CONTRIBUTING.md](./CONTRIBUTING.md) while contributing to the project :smile:.\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the MIT License. See [`LICENSE`](./LICENSE) for more information.\n\n\n\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\n[roerohan-url]: https://roerohan.github.io\n[issues-shield]: https://img.shields.io/github/issues/roerohan/react-vnc.svg?style=flat-square\n[issues-url]: https://github.com/roerohan/react-vnc/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froerohan%2Freact-vnc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froerohan%2Freact-vnc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froerohan%2Freact-vnc/lists"}